📄 idmessgae.pas
字号:
unit idmessgae;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,qsocket2,winsock,packetstruct,packetstruct1,DePacket,unit2,unit3;
var
MyList: TList;
lpList: TList;
p1:integer;
procedure idrecv;//人物坐标显示
procedure publicrecv;//接受公聊信息
procedure privaterecv;//接受密聊信息
procedure distroy;//消除节点
procedure wpselet;//发现物品的包
implementation
function func(var1:byte;var2:byte):word;
begin
asm
push ax;
xor ax,ax;
mov al,var2;
mov ah,var1;
mov @result,ax;
pop ax;
end;
end;
procedure idmess; //显示玩家信息
var
h:PMyList;
M,M1:string;
i,j:integer;
begin
M:='';M1:='';
h:= MyList.Items[p1];
M:=format('%s',[h^.bufname]);
M1:=format('在[%d,%d]坐标',[h^.x,h^.y]);
form2.Memo3.Lines.add('玩家'+M+M1);
p1:=p1+1;
end;
procedure idrecv; //玩家坐标信息进List
var
ARecord:PMyList;
begin
new(ARecord);
fillchar(ARecord^.dwFlag,4,$00);
fillchar(ARecord^.ID,3,$00);
fillchar(ARecord^.bufname,50,$00);
ARecord^.x:=0;
ARecord^.y:=0;
ARecord^.dwFlag:=StrToASCII(uncode,2);
ARecord^.ID:=StrToASCII(@uncode[2],3);
ARecord^.x:=smallint(func(byte(uncode[5]),byte(uncode[6])));
ARecord^.y:=smallint(func(byte(uncode[7]),byte(uncode[8])));
ARecord^.len:=integer(uncode[11]);
ARecord^.length:=shortint(uncode[12+ARecord^.len]);
copymemory(@ARecord^.bufname,uncode+13+ARecord^.len,ARecord^.length);
MyList.Add(ARecord);
idmess;
end;
procedure publicrecv;//接受公聊信息
var
i,len:integer;
q:PMyList;
s7:array [0..255] of char;
M3:string;
begin
fillchar(s7,255,$00);
M3:='';
for i:=0 to MyList.Count-1 do
begin
q:= MyList.Items[i];
if q^.ID=StrToASCII(@uncode[3],3) then
begin
len:=shortint(uncode[6]);
copymemory(@s7,uncode+7,len);
M3:=format('[公聊]%s 说:%s',[q.bufname,s7]);
form2.Memo1.Lines.Add(M3);
break;
end;
end;
end;
procedure distroy;//消除节点
var
ARecord,q:PMyList;
i,len:integer;
begin
len:=integer(uncode[2]);
q:=MyList.First;
i:=MyList.IndexOf(q);
begin
ARecord := MyList.Items[i];
if ARecord.ID=StrToASCII(@uncode[3],len) then
begin
Dispose(ARecord);
MyList.Delete(i);
end;
end;
end;
procedure privaterecv;//接受密聊信息
var
s8:array [0..30] of char; //密聊人物名
len,j:integer;
s6:array [0..255] of char;//聊天信息
M4,M5:string;
begin
fillchar(s8,30,$00);
fillchar(s6,255,$00);
len:=integer(uncode[3]);
copymemory(@s8,uncode+4,len);
j:=integer(uncode[4+len]);
copymemory(@s6,uncode+5+len,j);
//form2.Memo1.Lines.Add('收到');
if uncode[2]=char($03) then
begin
M4:=format('[密聊]%s对您说:',[s8]);
M5:=format('%s',[s6]);
form2.Memo1.Lines.Add(M4+M5);
end;
if uncode[2]=char($02) then
begin
M4:=format('[密聊]您对%s说:',[s8]);
M5:=format('%s',[s6]);
form2.Memo1.Lines.Add(M4+M5);
end;
M4:='';M5:='';
end;
procedure wpselet;//发现物品的包
var
p4:PwpLIst;
j:integer;
M,M1:string;
begin
new(p4);
fillchar(p4^.wpID,4,$00);
p4^.wpx:=0;
p4^.wpy:=0;
p4^.wpz:=0;
p4^.wpcount:=0;
p4^.wpw:=0;//怪物和物品辨别标志
p4^.wpx:=smallint(func(byte(uncode[12]),byte(uncode[13])));
p4^.wpy:=smallint(func(byte(uncode[14]),byte(uncode[15])));
p4^.wpcount:=integer(uncode[21]);
p4^.wpz:=smallint(func(byte(uncode[18]),byte(uncode[19])));
j:=p4^.wpz-$424d;
lpList.Add(p4);
if p4<>nil then
begin
M:=format('(%d,%d)',[p4^.wpx,p4^.wpy]);
M1:=format('%s',[wpbuf[j].wc]);
form2.Memo5.Lines.Add('物品'+M1+'在'+M);
end;
end;
end. .
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -