⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gamepacket.pas

📁 千年外挂通用
💻 PAS
字号:
unit gamepacket;

interface

uses
  Windows, Sysutils, Classes,        
  winsock2, datamanage, dllform, gamecode;

procedure gamePacketsend (buf:pchar; len:integer);
procedure gamePacketrecv (buf:pchar; len:integer);
procedure newsendnum;  //更新封包序列号

var
  stratnum : bool = false ;                     //初始化封包序号标志
  sendcount : array [0..1] of byte ;            //游戏发送封包序号 2字节. 无符号型
  newsendcount :pchar;                          //游戏发送封包序号 2字节. char型
  
implementation

procedure newsendnum;                           //更新封包序列号
begin
  if byte(newsendcount[0]) <> $FF then
    begin
    sendcount[0] := byte(newsendcount[0]);
    inc (sendcount[0]);
    sendcount[1] := byte(newsendcount[1]);
    newsendcount := @sendcount;
    end else                                    //如果第一位是FF 第二位加上 1
    begin
    sendcount[0] := $00;
    sendcount[1] := byte(newsendcount[1]);
    inc (sendcount[1]);
    newsendcount := @sendcount;
    end;
end;

procedure gamePacketsend (buf:pchar; len:integer);
var
  outchar,recvbuf : array [0..4096] of char ;
begin
  copychar ( buf, recvbuf, len );
  Decode ( @recvbuf[1], len-1, outchar);

  if stratnum = false then                      //初始化封包序列号 (只执行一次)
    begin
    sendcount[0] := byte(outchar[2]);
    sendcount[1] := byte(outchar[3]);
    newsendcount := @sendcount;
    stratnum := true;
    end;
end;


procedure gamePacketrecv (buf:pchar; len:integer);
var

  outchar,recvbuf : array [0..4104] of char ;
begin
  copychar ( buf, recvbuf, len );
  Decode ( @recvbuf[1], len-1, outchar);

  case ord(outchar[10]) of

  $05 : if dllform1.CheckBoxeat.Checked then eatmedication(@outchar[11]);//人物状态(年龄/元气/内.外.武.功.元气)
  $06 : gaingoods(outchar);                                     //往物品栏增加或减少物品
  $1C : begin                                                   //地图出现物品
        if dllform1.CheckBoxcollectgoods.checked  then
          begin
          collectgoods(outchar);                                //拾取
          end;
        showdropgoods(outchar);                                 //显示掉落物品
        end;
  end;
end;
  
end.


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -