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

📄 mainform.~pas

📁 纵横天地(开源) Delphi的功能很多``很值得大家学习
💻 ~PAS
📖 第 1 页 / 共 5 页
字号:
ReadProcessMemory(hProcess, Pointer(GameBase), @WuPinBase, 4, ByteRead);
WuPinBase:=WuPinBase+$DCF8;
BeiBaoMin:=1;
BeiBaoMax:=60;
if DoType='耐久度' then
begin
  BeiBaoMin:=61;
  BeiBaoMax:=75;
end;

For i :=BeiBaoMin to BeiBaoMax do
begin
    FillChar(CurWuName,15,0);
    WuAddr:=WuPinBase+i*$48;
    ReadProcessMemory(hProcess, Pointer(WuAddr+$3E), @CurWuID, 2, ByteRead);
    ReadProcessMemory(hProcess, Pointer(WuAddr+$40), @WuPinNum, 1, ByteRead);
    ReadProcessMemory(hProcess, Pointer(WuAddr+$42), @WuPinYanSe, 1, ByteRead);
    asm
      pushad
         movsx ecx,CurWuID
         imul ecx,ecx,$ADA
         add ecx,$14B3A88
         mov CurWuAddr,ecx
      popad
    end;
    ReadProcessMemory(hProcess, Pointer(CurWuAddr+$4), @WuPinType, 4, ByteRead);

    //装备=7 任务物品=4  普通物品=0   宝石=39  有琐的箱子=26  配方=6
    // 蓝=1 红=2  钥匙=34   战徽=12
    ReadProcessMemory(hProcess, Pointer(CurWuAddr+$9AE), @CurWuName, 15, ByteRead);
    TempWuName:=CurWuName;


    if DoType='耐久度' then
    begin
       if WuPinType=7 then  
       begin
           ReadProcessMemory(hProcess, Pointer(WuAddr+$41), @NaiJiuDu, 1, ByteRead);
           if NaiJiuDu<= strtoint(Form1.LabeledEdit26.Text)then
           begin
              ZhuangBeiBadNum:=ZhuangBeiBadNum+1;
              if ZhuangBeiBadNum>=strtoint(Form1.Edit11.Text) then
              begin
                  Result:=ZhungBeiDamage;
                  exit;
              end;
           end;
           Continue;
       end;
    end;
    
    if DoType='测试' then
    begin
     Form1.ListBox5.Items.Add(CurWuName+' 物品类型:'+inttostr(WuPinType));
     Continue;
    end;
    
    if DoType='刷新' then
    begin
      if CurWuID<>0 then
      begin
        if Pos('出售物品',FindWuName)<>0 then
            Form1.AddtoList(TempWuName,Form1.ListBox3);
        if Pos('清理背包',FindWuName)<>0 then
            Form1.AddtoList(TempWuName,Form1.ListBox4);
      end;
      Continue;
    end;

    if DoType='选择药品' then
    begin
       if CurWuID=0 then
          Continue;
       if  WuPinType=1 then
       begin
          Form1.ComboBox1.Items.Add(TempWuName);
          Form1.ComboBox3.Items.Add(TempWuName);
       end;
       if  WuPinType=2 then
       begin
          Form1.ComboBox2.Items.Add(TempWuName);
          Form1.ComboBox4.Items.Add(TempWuName);
       end;
       Continue;   
    end;

    if DoType='包满' then
    begin
        if CurWuID=0 then
        begin
          Result:=NoBaoMan;
          exit;
        end;
        Result:=BaoMan;
        Continue;
    end;


    if DoType='物品位置' then
    begin
        if Pos(Trim(FindWuName),TempWuName)<>0 then
        begin
             Result:=i;
             exit;
        end;
        Continue;
    end;

    if DoType='物品ID' then
    begin
        if Pos(Trim(FindWuName),TempWuName)<>0 then
        begin
             Result:=CurWuID;
             exit;
        end;
        Continue;
    end;

    if DoType='物品数目' then
    begin
        if Pos(Trim(FindWuName),TempWuName)<>0 then
        begin
             Result:=WuPinNum;
             exit;
        end;
        Continue;
    end;

    if DoType='出售' then
    begin

        if Form1.CheckBox36.Checked then
        begin
           if WuPinType=0 then
           begin
                 Call.Sell(i);
                 Sleep(200);
           end;
           Continue;
        end;

        if WuPinType=4 then    //任务物品
            Continue;
                    
        if  Form1.CheckBox21.Checked then
        begin
           if WuPinYanSe=2 then
              Continue;
        end;

        if  Form1.CheckBox22.Checked then
        begin
           if (WuPinType=1)or(WuPinType=2) then
              Continue;
        end;

        if  Form1.CheckBox38.Checked then
        begin
           if WuPinType=26 then
              Continue;
        end;
        
        if Form1.CheckBox19.Checked then
        begin
            if CurWuID=0 then
                Continue;
            if Form1.FindInList(TempWuName,Form1.ListBox3) then
            begin
                 Call.Sell(i);
                 Sleep(200);
                 Result:=NoSellFinish;
                 Continue;
            end;
        end;

        if Form1.CheckBox20.Checked then
        begin
            if CurWuID=0 then
                Continue;

            if not Form1.FindInList(TempWuName,Form1.ListBox3) then
            begin
                 Call.Sell(i);
                 Sleep(200);
                 Result:=NoSellFinish;
                 Continue;
            end;
        end;
    end;
end;

if DoType='出售' then
begin
   Result:=SellFinish;
end;
end;

procedure WriteGuaiWuID(GuaiID:Integer);  //直接写内存选怪
begin
     if (hProcess=0)or(GuaiID=0) then
        exit;

WriteProcessMemory(hProcess, Pointer(XuanZhongGuaiBase), @GuaiID, 4, ByteRead);
WriteProcessMemory(hProcess, Pointer(WriteGuaiIDBase), @GuaiID, 4, ByteRead);
end;

Function GetGuaiWuInfo(DoType:String;FindGuaiName:string):Integer;
var
  i,j,GuaiBase,MinGuaiAddr,MaxGuaiAddr,CurGuaiAddr:Integer;
  GuaiNum,GuaiID,TempGuaiID,GuaiDengJi,KillGuaiID,GuoLvGuaiId,CurGuaiXue:Integer;
  GuaiX,GuaiY,GuaiZ:Single;
  FGuaiX,FGuaiY,FRenX,FRenY:Integer;
  x,y:Integer;
  JuLi,GuaiJuLi:Integer;
  GuaiType:Integer;
  ZhiYe:Byte;
  JiNengID:Integer;
  GuaiName:Array[0..14]of char;
  TempGuaiName:String;
begin
if hProcess=0 then
  exit;
Result:=-1;
if DoType='刷新' then
    Form1.ListBox2.Clear;

if DoType='测试' then
    Form1.ListBox5.Clear;
    
GuaiJuLi:=50;
GuaiBase:=$833B70;
GuaiBase:=GuaiBase+$40;
ReadProcessMemory(hProcess, Pointer(GuaiBase+$4), @MinGuaiAddr, 4, ByteRead);
ReadProcessMemory(hProcess, Pointer(GuaiBase+$8), @MaxGuaiAddr, 4, ByteRead);
GuaiNum:=(MaxGuaiAddr-MinGuaiAddr) div 4;
For i:=0 to GuaiNum-1 do    
begin
  FillChar(GuaiName,15,0);
  ReadProcessMemory(hProcess, Pointer(MinGuaiAddr+i*4), @CurGuaiAddr, 4, ByteRead);
  if CurGuaiAddr<>0 then
  begin
     ReadProcessMemory(hProcess, Pointer(CurGuaiAddr+$4), @GuaiID, 4, ByteRead);
     if GuaiID=0 then
        Continue;

     ReadProcessMemory(hProcess, Pointer(CurGuaiAddr+$C), @GuaiType,4, ByteRead);//2 为自己,1为怪物,4为箱子
     ReadProcessMemory(hProcess, Pointer(CurGuaiAddr+$143), @ZhiYe,1, ByteRead);

     ReadProcessMemory(hProcess, Pointer(CurGuaiAddr+$150), @CurGuaiXue, 4, ByteRead);
     ReadProcessMemory(hProcess, Pointer(CurGuaiAddr+$108), @GuaiX, 4, ByteRead);
     ReadProcessMemory(hProcess, Pointer(CurGuaiAddr+$10C), @GuaiZ, 4, ByteRead);
     ReadProcessMemory(hProcess, Pointer(CurGuaiAddr+$110), @GuaiY, 4, ByteRead);

     ReadProcessMemory(hProcess, Pointer(CurGuaiAddr+$118), @GuaiDengJi, 4, ByteRead);
     ReadProcessMemory(hProcess, Pointer(CurGuaiAddr+$AC), @GuaiName, 15, ByteRead);
     TempGuaiName:=GuaiName;
     if (Pos('货物包裹',TempGuaiName)<>0)or(Pos('石球',TempGuaiName)<>0)then
     begin
       Continue;
     end;

     if DoType='测试' then
     begin
         TempGuaiName:=TempGuaiName+'  类型: '+inttostr(GuaiType)+' 职业: '+inttostr(ZhiYe);
         Form1.AddtoList(TempGuaiName,Form1.ListBox5);
         Continue;
     end;
    if DoType='刷新' then
    begin
       if GuaiType=1 then
          Form1.AddtoList(GuaiName,Form1.ListBox2);
    end;

    if DoType='怪物ID' then
    begin
        if Pos(Trim(FindGuaiName),Trim(TempGuaiName))<>0 then
        begin
            Result:=GuaiID;
            exit;
        end;
    end;


    if DoType='箱子' then
    begin
      if Pos('箱子',TempGuaiName)<>0 then
      begin
           For j:=0 to 4 do
           begin
              Call.JianWu(j,GuaiID);
           end;
           exit;   
       end;
    end;
    
   if DoType='选怪' then
   begin
      if CurGuaiXue=0 then
        Continue;
      if GuaiType<>1 then
         Continue;
      if Form1.CheckBox17.Checked then
         if not Form1.FindInList(Trim(GuaiName),Form1.ListBox2) then
         begin
              continue;
         end;

      if Form1.CheckBox18.Checked then
         if  Form1.FindInList(Trim(GuaiName),Form1.ListBox2) then
         begin
              continue;
         end;

      if (Form1.CheckBox17.Checked)  or (Form1.CheckBox18.Checked) then
      begin
            FRenX:=Round(RenX); FRenY:=Round(RenY) ;
            FGuaiX:=Round(GuaiX); FGuaiY:=Round(GuaiY) ;
            x:=FRenX-FGuaiX;y:=FRenY-FGuaiY;
            JuLi:=Trunc(sqrt(x*x+y*y));
            if JuLi<GuaiJuLi then
            begin
                if JuLi<=2 then
                begin
                   WriteGuaiWuID(GuaiID);
                   exit;
                end;
                GuoLvGuaiId:=GuaiID;
                GuaiJuLi:=JuLi;
            end;
      end;
   end;
    
  end;
end;
   if DoType='选怪' then
   begin
       WriteGuaiWuID(GuoLvGuaiId);
   end;
end;


procedure TForm1.Timer1Timer(Sender: TObject);
const
{$j+}IsInitFinish:Boolean=False{$j-};
{$j+}IsDo:Boolean=False{$j-};
{$j+}IsLogo:Boolean=False{$j-};
{$j+}IsUp:Boolean=False{$j-};
var
SaveTime,GuaiID:Integer;
begin
  if not IsInitFinish then    
  begin
      SaveTime:=0;
      StatusBar1.Panels[0].Text :='正在获取人物数据。。。';
      IsInitFinish:=True;
      InitGameProcess;
  end;


  GetPersonInfo;
  if not IsDo then
  begin
       StatusBar1.Panels[0].Text:='';
       IsDo:=True;
       SendMessage(ZHHwnd,WM_GETMAXBLOODADDR,0,0);
       SendMessage(ZHHwnd,WM_GETNPCLISTADDR,0,0);
       exit;
  end;

  if Trim(LabeledEdit1.Text) <>''then
  begin
     if not IsLogo then
     begin
       IsLogo:=True;
       LoadInitFile(Trim(LabeledEdit1.Text));
       Form1.Height :=FormH;
       Form1.Width:=FormW;   
       if HotKeyThread=Nil then
       begin
           HotKeyThread:=THotKeyThread.Create(True);
       end;
     end;
  end;
  
 if SaveTime=0 then
    SaveTime:=GetTickCount;
 if SleepFun(10,SaveTime) then
 begin
    SaveInitFile;
    SaveTime:=0;
 end;

 if Form1.CheckBox37.Checked then
 begin
     if CurXue<=strtoint(LabeledEdit30.Text)then
     begin
        if not IsUp then
        begin
          StartFeiTian;   //开始飞天
          IsUp:=True;
        end;  
     end;

     if IsUp then
     begin
        ReadProcessMemory(hProcess, Pointer(WriteGuaiIDBase), @GuaiID, 4, ByteRead);
        if GuaiID<>0 then
        begin
           GuaiID:=0;
           WriteProcessMemory(hProcess, Pointer(WriteGuaiIDBase), @GuaiID, 4, ByteRead);
        end;
        if Round(RenZ)>=190 then
           StopFeiTian;  //停止飞天  PS:如果不停止,无法在空中走路
        if CurXue=MaxXue then
        begin
            Down;      //从天上下来
            IsUp:=False;
        end;
     end;
 end;

end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
Ret:Integer;
begin
  if hProcess<>0 then
  begin
      Down;
      if  CheckBox33.Checked then
      begin
         ShowWindow(ZhHwnd,SW_SHOW); 
      end;
      if (ThreadAddr<>Nil)  and  (ParamAddr<>NIL) then
      begin
        VirtualFreeEx(hProcess, ThreadAddr, MemSize, MEM_RELEASE);
        VirtualFreeEx(hProcess, ParamAddr, 20, MEM_RELEASE);
        VirtualFreeEx(hProcess, JiNengAddr, 40, MEM_RELEASE);
      end;
      CloseHandle(hProcess);
      if HotKeyThread<>Nil then
      begin
         HotKeyThread.Terminat

⌨️ 快捷键说明

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