Results 1 to 4 of 4
  1. #1
    idk123
    idk123 is offline
    Guest
    Join Date
    2012 May
    Posts
    2
    Thanks Thanks Given 
    0
    Thanks Thanks Received 
    2
    Thanked in
    1 Post
    Rep Power
    0

    delphi source code - npcgen.data NPC dumper

    Hi, this source code is a 5 min messy source which rads serversided npcgen.data for 1.4.4 private serers
    PWI
    Messy as hell, unoptimized, and slow
    but works
    Will dump all NPC into text file
    Code:
    unit Main;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls,math, ComCtrls,StrUtils;
    
    type
      TForm1 = class(TForm)
        Button1: TButton;
        Memo1: TMemo;
        Button2: TButton;
        ProgressBar1: TProgressBar;
        procedure Button1Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        { Private-Deklarationen }
      public
        { Public-Deklarationen }
      end;
    
    type
      TNPCDude = record
        ID : Cardinal;
        X : Single;
        Y : Single;
        Z : Single;
      end;
    
    type
     TNPCDudes = array of TNPCDude;
    
    var
      Form1: TForm1;
      NPCs : TNPCDudes;
      fs : TFilestream;
      ml : TStringlist;
    
    implementation
    
    {$R *.dfm}
    
    {
    
    Function GetNPCName (ID : Cardinal) : string;
    var
    i : Integer;
    begin
    ml.LoadFromFile('npclist.txt');
    for I := 0 to ml.Count - 1 do
      begin
        if StrUtils.ContainsText(ml[i],IntToStr(ID)) =  true then
          begin
          if ContainsText(ml[i],' '
          result := Copy(ml[i],Pos('  ',
          end;
    
      end;
    
    end;   }
    
    
    Function WeGotThis(ID : Cardinal) : Boolean;
    var i : integer;
    begin
      result := false;
      for i := 0 to length(NPCs) - 1 do
        if NPCs[i].ID = ID then
        begin
          result := True;
          Exit;
        end;
    end;
    
    
    function FileSize(fileName: wideString): Int64;
    var
      sr: TSearchRec;
    begin
      if FindFirst(fileName, faAnyFile, sr) = 0 then
        result := Int64(sr.FindData.nFileSizeHigh) shl Int64(32) +
          Int64(sr.FindData.nFileSizeLow)
      else
        result := -1;
    
      FindClose(sr);
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
    i : integer;
    Buffer : array of Byte;
    NPCType,Structtype : Cardinal;
    t1,t2,t0 : cardinal;
    offset,lastoffset : cardinal;
    sl : TStringlist;
    files : Cardinal;
    nCreatures : Cardinal;
    tid : cardinal;
    begin
    files := FileSize('npcgen.data');
    fs := TFileStream.Create('npcgen.data',fmOpenRead);
    SetLength(Buffer,files);
    fs.ReadBuffer(Buffer[0],files);
    sl := TStringList.Create;
    
    
    t1 := 0;
    t0 := 0;
    t2 := 0;
    offset := 24;
    
     Copymemory(@nCreatures,@Buffer[4],4);
     ProgressBar1.Max := nCreatures;
     Setlength(NPCs,nCreatures);
      for i := 0 to nCreatures -1 do
      begin
    
          Copymemory(@NPCType,@Buffer[offset + 40 {NPC type in struct} ],4);
    
          Copymemory(@tid,@Buffer[Offset + 67],4);
    
    
          Copymemory(@NPCs[i].X,@Buffer[Offset + 4],4);
          NPCs[i].X := NPCs[i].X / 10 + 400;
    
          Copymemory(@NPCs[i].Y,@Buffer[Offset + 12],4);
          NPCs[i].Y := NPCs[i].Y / 10 + 550;
    
          Copymemory(@NPCs[i].Z,@Buffer[Offset + 8],4);
          NPCs[i].Z := NPCs[i].Z / 10;
    
          NPCs[i].ID := tid;
    
          sl.Add(IntToStr(NPCs[i].ID) + ' X : ' +
          FloatToStr(NPCs[i].X) + ' Y ' +
          FloatToStr(NPCs[i].Y)  + ' Z : ' +
          FloatToStr(NPCs[i].Z)  +
           ' -> '+ IntToStr(offset));
    
    
    
    
          Copymemory(@StructType,@Buffer[offset{NPC type in struct} ],4);
    
    
          case Structtype of
          0 : Inc(offset,71);
          1 : inc(offset,131);
          2 : inc(offset,191);
          3 : inc(offset,251);
          4 : inc(offset,311);
          5 : inc(offset,371);
          6 : inc(offset,431);
          7 : inc(offset,491);
          end;
    
          if lastoffset = Offset then
          begin
          Memo1.Lines.Add('error, unknown datatype : ' + IntToStr(offset));
          sl.SaveToFile('test.txt');
          Exit;
          end;
          lastoffset := offset;
    
    
          ProgressBar1.Position := i;
          Application.ProcessMessages;
    
    
    
      end;
    
      sl.SaveToFile('test.txt');
      Memo1.Lines.Add('Done, no errors! :)');
    
    
    
    
    end;
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
    ml := TStringList.Create;
    end;
    
    end.
    Last edited by Grooguz; 2012-05-22 at 04:17 AM.

  2. The Following 2 Users Say Thank You to idk123 For This Useful Post:


  3. #2
    Grooguz
    Grooguz is offline
    BanHammer Holder
    Grooguz's Avatar
    Join Date
    2010 May
    Posts
    678
    Thanks Thanks Given 
    152
    Thanks Thanks Received 
    537
    Thanked in
    167 Posts
    Rep Power
    15
    And where is code?

  4. #3
    idk123
    idk123 is offline
    Guest
    Join Date
    2012 May
    Posts
    2
    Thanks Thanks Given 
    0
    Thanks Thanks Received 
    2
    Thanked in
    1 Post
    Rep Power
    0
    sorry about that wrong link lol, edited

  5. #4
    Grooguz
    Grooguz is offline
    BanHammer Holder
    Grooguz's Avatar
    Join Date
    2010 May
    Posts
    678
    Thanks Thanks Given 
    152
    Thanks Thanks Received 
    537
    Thanked in
    167 Posts
    Rep Power
    15
    Reputation for good stuff

    good stuff + account activated, welcome

Similar Threads

  1. [C#] Offset Finder with FindPattern Source Code
    By Grooguz in forum VB, .NET Framework
    Replies: 3
    Last Post: 2021-01-14, 06:26 PM
  2. [AutoIt] RegEx Offset Finder Source code
    By Grooguz in forum AutoIt
    Replies: 1
    Last Post: 2012-08-04, 03:50 PM
  3. [C++] Game Making Tutorial Videos + Source Code
    By Dwar in forum C/C++
    Replies: 4
    Last Post: 2012-05-22, 12:35 PM
  4. [C#] Memory editing application with Source code
    By Grooguz in forum Programming Tutorials
    Replies: 2
    Last Post: 2012-01-05, 08:44 AM
  5. Question about tracing source code to memory
    By Bloapie in forum General Game Research
    Replies: 1
    Last Post: 2010-10-19, 09:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •