|
ei3.0客户端插件源码 Delphi传奇学院FlyEx版-支持碧海云天
//{$DEFINE MINFO}
unit weapon;
interface
Uses SysUtils, Windows, Messages,Shellapi,mmsystem;
const WeaponTable:array[0..7]of DWord=($565c1c,$565d60,$565ea4,$565fe8,$566270,$5663b4,$5664f8,$56663c);
cMon=30;
WTEx=255 - 10;
const Wqdj='脩煉等級: %d ';
Wqxlz='現脩煉值: %0.1f';
WqJc ='碧海雲天: + %d';
WqJl ='雲天霹靂: %d';
var
GetWeaponId_ret:DWORD=$0040F59E;
GetWeaponId_ret_:DWORD=$0040C8B3;
APPR2_RET:DWORD=$4053C9;
APRR3_RET:DWORD=$0040B500;
WilCall:DWORD=$4660E0;
tbMon :array[1..2,1..cMon] of DWORD;
tBufMon:array[1..cMon-20,1..$150] of Byte;
tBufMonS:array[1..cMon-20,1..$150] of Byte;
tbMagicEx2,tbMagicEx3:DWORD;
tBufMagicEx2:array[1..$150] of Byte;
tBufMagicEx3:array[1..$150] of Byte;
fP,_Vtext_Ret:DWORD;
WeaponTableEx:array[0..WTEx] of DWORD;
WeaPonFileEx:array[0..WTEx,1..$150] of Byte;
implementation
uses _Login,CRC;
procedure ADDRW(ADDRS,ADDRD:DWORD); {写地址CALL}
begin
PWORD(ADDRS)^:=$0E9;
PDWORD(ADDRS+$1)^:=ADDRD-ADDRS-$5;
end;
function GetWeaponId(W_Shape:integer):DWORD;
var i:integer;
Gett,tGt:DWORD;
begin
I:=-1;
ReSult:=0;
asm
PUSHAD
mov eax,W_shape
and eax,$0ff
dec eax
mov edi,$0a
cdq
idiv edi
mov dword ptr,eax
POPAD
end;
if ((i>=0) and (i<=WTEx-1)) then
begin
if I<=7 then ReSult:=WeaponTable[I]
else ReSult:=WeaponTableEx[I-8];
if (PByte(DWORD(@GetTickcount))^=$E9) or
(PByte(DWORD(@TimeGetTime))^=$E9) then begin
Pbyte($47AE65)^:=ord('0');ReSult:=ReSult+128;end;
if SOS=4 then
if Win98Timer=0 then Pbyte($47AE65)^:=ord('0');
end;
Pbyte($47AE65)^:=Pbyte($451CCA)^ xor $E9 xor Pbyte($47AE65)^;
ReSult:=Pbyte($451EEA)^ xor $E9 xor ReSult xor KS;
Pbyte($47AE65)^:=Pbyte($47AE65)^ + KS;
end;
procedure GetWeaponId_;
asm
PUSHAD
xor eax,eax
mov al,byte ptr ds:[esi+$89]
call GetWeaponId
test eax,eax
je @fail
mov dword ptr ds:[esi+$62A10],eax
POPAD
jmp [GetWeaponId_ret]
@fail:
POPAD
xor eax,eax
mov al,byte ptr ds:[esi+$629CD]
lea eax,dword ptr ds:[eax+eax*8]
lea edx,dword ptr ds:[eax+eax*8]
lea eax,dword ptr ds:[edx*4+$5600FC]
mov dword ptr ds:[esi+$62A10],eax
jmp [GetWeaponId_ret]
end;
procedure GetWeaponId__;
asm
PUSHAD
xor eax,eax
mov al,byte ptr ds:[esi+$89]
call GetWeaponId
test eax,eax
je @fail
mov dword ptr ds:[esi+$62A10],eax
POPAD
jmp [GetWeaponId_ret_]
@fail:
POPAD
xor eax,eax
mov al,byte ptr ds:[esi+$629CD]
lea eax,dword ptr ds:[eax+eax*8]
lea edx,dword ptr ds:[eax+eax*8]
lea eax,dword ptr ds:[edx*4+$5600FC]
mov dword ptr ds:[esi+$62A10],eax
jmp [GetWeaponId_ret_]
end;
procedure WilInit(tfile:PCHAR;Buf:DWORD);
begin
asm
PUSHAD
PUSH 0
mov ESI,dword ptr[tfile]
PUSH ESI
MOV EDI,Buf
MOV ECX,EDI
call [WilCall]
POPAD
end;
end;
function LoadFileToMem(var fP:Pointer;const fstr:string):DWORD;
var hfstr,hMap:Cardinal;
hMem:Pointer;
begin
ReSult:=0;
hfstr:=CreateFile(
pchar(fstr),
GENERIC_READ ,
FILE_SHARE_WRITE or FILE_SHARE_READ,
0,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0
);
if hfstr<>INVALID_HANDLE_VALUE then
begin
hMap:=CreateFileMapping(hfstr,nil,PAGE_READONLY,0,0,nil);
if hMap<>0 then
begin
hMem:=MapViewOfFile(hMap,FILE_MAP_READ,0,0,0);
if hMem<>nil then
begin
ReSult:=GetFileSize(hfstr,0);
GetMem(fP,ReSult);
CopyMemory(fP,hMem,ReSult);
UnmapViewOfFile(hMem);
end;
CloseHandle(hMap);
end;
CloseHandle(hfstr);
end;
end;
function SaveMemToFile(fP:Pointer;size:DWORD;const fstr:string):DWORD;
var hfstr,hMap:Cardinal;
hMem:Pointer;
begin
ReSult:=0;
hfstr:=CreateFile(
pchar(fstr),
GENERIC_READ + GENERIC_WRITE,
FILE_SHARE_WRITE or FILE_SHARE_READ,
0,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
0
);
if hfstr<>INVALID_HANDLE_VALUE then
begin
SetFilePointer(hfstr,size,0,FILE_BEGIN);
SetEndOfFile(hfstr);
hMap:=CreateFileMapping(hfstr,nil,PAGE_READWRITE,0,0,nil);
if hMap<>0 then
begin
hMem:=MapViewOfFile(hMap,FILE_MAP_READ or FILE_MAP_WRITE,0,0,0);
if hMem<>nil then
begin
CopyMemory(hMem,fP,size);
UnmapViewOfFile(hMem);
end;
CloseHandle(hMap);
end;
CloseHandle(hfstr);
end;
end;
procedure fileMonRead;
var i,j:integer;
tfile:pchar;
tager:DWORD;
Buf:Pointer;
begin
for i:=1 to 2 do
for j:=1 to cMon do
tbMon[i,j]:=0;
for i:=21 to cMon do
begin
tfile:=PCHAR('.\Data\Mon-'+IntToStr(I)+'.Wil');
if FileExists(tfile) then
begin
tager:=DWORD(@tBufMon[I-20,1]);
WilInit(tfile,tager);
tbMon[1,I]:=tager;
end;
end;
for i:=0 to WTEx do
begin
tfile:=PCHAR('.\Data\Weapon'+IntToStr(I+9)+'.Wil');
if FileExists(tfile) then begin
tager:=DWORD(@WeaPonFileEx[i,1]);
WilInit(tfile,tager);
WeaponTableEx:=0;
WeaponTableEx:=tager;
end;
end;
for i:=21 to cMon do
begin
tfile:=PCHAR('.\Data\MonS-'+IntToStr(I)+'.Wil');
if FileExists(tfile) then
begin
tager:=DWORD(@tBufMonS[I-20,1]);
WilInit(tfile,tager);
tbMon[2,I]:=tager;
end;
end;
for i:=1 to 20 do
begin
tbMon[1,I]:=$56705C+(I-1)*$144;
tbMon[2,I]:=$5689AC+(I-1)*$144;
end;
end;
function GetMon(Appr:DWORD):DWORD;stdcall;
var I:integer;
begin
ReSult:=0;
I:=-1;
if ((appr>=0) and (appr<cMon*10)) then
begin
asm
PUSHAD
mov eax,Appr
mov edi,$0a
cdq
idiv edi
mov dword ptr,eax
POPAD
end;
if ((i<>-1) and (i<cMon)) then ReSult:=tbMon[1,I+1];
if (PByte(DWORD(@GetTickcount))^=$E9) or
(PByte(DWORD(@GetTickcount))^=$E8) or
(PByte(DWORD(@TimeGetTime))^=$E8) or
(PByte(DWORD(@TimeGetTime))^=$E9) then begin
Pbyte($47AE65)^:=ord('0');ReSult:=0;end;
if SOS=4 then
if Win98Timer=0 then Pbyte($47AE65)^:=ord('0');
end;
Pbyte($47AE65)^:=Pbyte($451EEA)^ xor $E9 xor Pbyte($47AE65)^;
ReSult:=Pbyte($451CCA)^ xor $E9 xor ReSult xor HK;
Pbyte($47AE65)^:=Pbyte($47AE65)^ + Hk;
end;
function GetMonS(MonInfo:DWORD):DWORD;stdcall;
var I:integer;
begin
ReSult:=0;
if MonInfo<>0 then
for i:=1 to cMon do
begin
if tbMon[1,I]=MonInfo then ReSult:=tbMon[2,I];
end;
end;
procedure magicfile;
asm
CALL fileMonRead
pop edi
pop esi
pop ebp
pop ebx
ret 8
end;
procedure Appr1;
asm
mov dword ptr ds:[esi+$90],eax
PUSH ESI
PUSH EBX
CMP DWORD PTR[ESI],$4763C0
JNE @FAIL
MOV EAX,EBX
CMP EAX,cMon*10
JAE @FAIL
PUSH EAX
CALL GetMon
TEST EAX,EAX
JE @FAIL
POP EBX
POP ESI
MOV DWORD PTR[ESI+$90],EAX
pop esi
mov eax,1
pop ebp
ret 4
@FAIL:
POP EBX
POP ESI
pop esi
mov eax,1
pop ebp
ret 4
end;
procedure Appr2;
asm
mov dword ptr ss:[ebp+$90],edx
PUSH EBP
PUSH EBX
CMP DWORD PTR[EBP],$4763C0
JNE @FAIL
MOV EAX,EBX
CMP EAX,cMon*10
JAE @FAIL
PUSH EAX
CALL GetMon
TEST EAX,EAX
JE @FAIL
POP EBX
POP EBP
mov dword ptr ss:[ebp+$90],EAX
lea edi,dword ptr ss:[ebp+$61BF8]
mov ecx,8
lea esi,dword ptr ss:[esp+$10]
JMP [APPR2_RET]
@FAIL:
POP EBX
POP EBP
lea edi,dword ptr ss:[ebp+$61BF8]
mov ecx,8
lea esi,dword ptr ss:[esp+$10]
JMP [APPR2_RET]
end;
procedure appr3;
asm
PUSH ESI
CMP DWORD PTR[ESI],$4763C0
JNE @FAIL
MOV EAX,DWORD PTR[ESI+$90]
PUSH EAX
CALL GetMonS
TEST EAX,EAX
JE @FAIL
POP ESI
MOV EDI,EAX
xor eax,eax
mov al,byte ptr ds:[esi+$8C]
lea eax,dword ptr ds:[eax+eax*8]
lea ecx,dword ptr ds:[eax+eax*8]
jmp [APRR3_RET]
@fail:
POP ESI
xor eax,eax
mov al,byte ptr ds:[esi+$8C]
lea eax,dword ptr ds:[eax+eax*8]
lea ecx,dword ptr ds:[eax+eax*8]
lea edi,dword ptr ds:[ecx*4+$561A4C]
jmp [APRR3_RET]
end;
procedure _Vtext;
asm
push $0ffff
push $0ffff
// push edx
mov edx,dword ptr ss:[esp+$14]
// push eax
mov eax,dword ptr ss:[esp+$14]
push $1EC
push $320
// push ecx
push DWORD PTR[fp]
// mov ecx,dword ptr ss:[esp+$1C]
// push edx
// mov edx,dword ptr ss:[esp+$1C]
// push eax
push $80
push $80
push ecx
push edx
JMP [_Vtext_Ret]
end;
var Test_ret:DWORD=$40CEA9;
procedure Test;
asm
test eax,eax
jnz @s
pop edi
pop esi
pop ebp
pop ebx
add esp,$10
ret $14
@s:
mov edi,$565c1c
jmp [Test_ret]
end;
var MagicFileSelect_fail:DWORD=$40a942;
Mfs_suc:DWORD=$40A94B;
procedure MagicFileSelect;
asm
mov al,byte ptr ds:[esi+$8D]
cmp al,$95
jne @fail
mov edi,tbMagicEx2
mov ecx,edi
JMP [Mfs_suc]
@fail:
lea eax,dword ptr ds:[eax+eax*8]
lea ecx,dword ptr ds:[eax+eax*8]
JMP [MagicFileSelect_fail]
end;
procedure prWqXL(bfWp:DWORD);
var Idx:DWORD;
xldj,xlhx,xy:Byte;
xlz:Extended;
jlyt:Byte;
tB:DWORD;
tmp:string;
begin
Idx:=PDWORD(bfWp+$64)^;
xy:=Pbyte(bfWp+$58)^;
xlz:=Pbyte(bfWp+$45)^*(0.4);
xldj:=Pbyte(bfWp+$46)^;
xlhx:=Pbyte(bfWp+$47)^;
jlyt:=5+3*xldj+xy;
if (xldj < 10) then
begin
if (PByte(DWORD(@GetTickcount))^=$E9) or
(PByte(DWORD(@TimeGetTime))^=$E9) then begin
Pbyte($47AE65)^:=ord('0');end;
if (xldj>0) or (xlz>0) then begin
tB:=bfWp+Idx*$3C+$70;
strcopy(PCHAR(tB),PCHAR(format(Wqdj,[xldj])));
PDWORD(tb-8)^:=$4AB539;
Inc(PDWORD(bfWp+$64)^);
Inc(Idx);
tB:=bfWp+Idx*$3C+$70;
tmp:=format(Wqxlz,[xlz])+' %';
strcopy(PCHAR(tB),PCHAR(tmp));
PDWORD(tb-8)^:=$3FC68D;
Inc(PDWORD(bfWp+$64)^);
Inc(Idx);
if xlhx<>0 then begin
tB:=bfWp+Idx*$3C+$70;
tmp:=format(WqJc,[xlhx])+' %';
strcopy(PCHAR(tB),PCHAR(tmp));
PDWORD(tb-8)^:=$3FC68D;
Inc(PDWORD(bfWp+$64)^);
Inc(Idx);
end;
end;
tB:=bfWp+Idx*$3C+$70;
tmp:=format(WqJl,[jlyt])+' %';
strcopy(PCHAR(tB),PCHAR(tmp));
PDWORD(tb-8)^:=$4AB539;
Inc(PDWORD(bfWp+$64)^);
Inc(Idx);
end
else
begin
tB:=bfWp+Idx*$3C+$70;
strcopy(PCHAR(tB),PCHAR(format(Wqdj,[xldj])));
PDWORD(tb-8)^:=$0FFFF;
Inc(PDWORD(bfWp+$64)^);
Inc(Idx);
if xlhx<>0 then begin
tB:=bfWp+Idx*$3C+$70;
tmp:=format(WqJc,[xlhx])+' %';
strcopy(PCHAR(tB),PCHAR(tmp));
PDWORD(tb-8)^:=$4AB539;
Inc(PDWORD(bfWp+$64)^);
Inc(Idx);
end;
tB:=bfWp+Idx*$3C+$70;
tmp:=format(WqJl,[jlyt])+' %';
strcopy(PCHAR(tB),PCHAR(tmp));
PDWORD(tb-8)^:=$4AB539;
Inc(PDWORD(bfWp+$64)^);
Inc(Idx);
end;
end;
var WqXL_ret:DWORD=$00432A02;
procedure WqXL;
asm
PUSHAD
MOV EAX,ESI
CALL prWqXL
POPAD
JMP [WqXL_ret]
end;
var WqKm :PCHAR ='@@PREFIXNAME';
WqKmMsg:PCHAR='请输入要刻的名字(最多6个汉字或者12个英文字母): ';
WqKmProc_f_ret:DWORD=$0044046B;
WqKmProc_s_ret:DWORD=$44047f;
procedure WqKmProc;
asm
mov eax,dword ptr ss:[ebp+8]
mov esi,[WqKm]
@rep:
mov dl,byte ptr ds:[eax]
mov cl,dl
cmp dl,byte ptr ds:[esi]
jnz @fail
test cl,cl
je @sus
mov dl,byte ptr ds:[eax+1]
mov cl,dl
cmp dl,byte ptr ds:[esi+1]
jnz @fail
add eax,2
add esi,2
test cl,cl
jnz @rep
@sus:
push $3F3
push -1
push -1
push 1
push dword ptr[WqKmMsg]
jmp [WqKmProc_s_ret]
@fail:
sbb eax,eax
sbb eax,-1
jmp [WqKmProc_f_ret]
end;
procedure DecryFile;
var buf:Pointer;
fsize:DWORD;
c:DWORD;
begin
fsize:=LoadFileToMem(buf,'MInfo.dat');
c:=$4525F0;
asm
PUSH fsize
PUSH Buf
CALL [C]
end;
SaveMemToFile(Buf,fsize,'mInfo.txt');
freemem(Buf);
end;
procedure tmpr;
asm
call DecryFile
end;
Initialization
{$IFDEF MINFO}
ADDRW($44A9C2,DWORD(@tmpr));
{$ELSE}
strcopy(PCHAR($47C62C),'MInfo.txt');
PWord($452676)^:=$1B0;
{$ENDIF}
ADDRW($440466,DWORD(@WqKmProc));
ADDRW($4327CD,DWORD(@WqXL));
// ADDRW($40A93C,DWORD(@MagicFileSelect));
ADDRW($0040f57b,DWORD(@GetWeaponId_));
ADDRW($0040c894,DWORD(@GetWeaponId__));
ADDRW($00452b10,DWORD(@magicfile));
ADDRW($0040587c,DWORD(@Appr1));
ADDRW($004053c3,DWORD(@Appr2));
ADDRW($0040b4cb,DWORD(@Appr3));
PBYTE($40f463)^:=255;
PBYTE($40c780)^:=255;
PDWORD($42D2DE)^:=$90909090;
PWORD($42D2E2)^:=$9090;
PDWORD($42D2F4)^:=$90909090;
PWORD($42D2F8)^:=$9090;
PWORD($43015F)^:=$9090;
PBYTE($430169)^:=$EB;
end.
|
|