Results 1 to 4 of 4
  1. #1
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    818
    Reputation
    125
    Thanks
    1,785
    My Mood
    Doh

    CBL Checker(Delphi)

    I have a few people pm about the CBL checker program, so here it is

    Code:
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      if Key = VK_RETURN then
        Button1.Click;
    end;
    
    Function Extract(Const sString, Stat: String): String;
    Var
      sTemp: String;
    begin
      Result := '';
      sTemp := TRegEx.Match(sString, '(?si)<td class="item">' + Stat +
        '</td>.*?</td>').Value;
      sTemp := TRegEx.Match(sTemp, '(?si)value">.*?</td>').Value;
      Result := Copy(sTemp, 8, Length(sTemp) - 12);
    end;
    
    procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      IdHTTP1.Free;
    end;
    
    Procedure TForm1.ParseStats(Const sString: String);
    var
      sTemp: String;
    begin
      sTemp := sString;
      Delete(sTemp, 1, pos('<table class="plrStats"', sTemp));
      lblKills.Caption := Extract(sTemp, 'Kills');
      lblDeaths.Caption := Extract(sTemp, 'Deaths');
      lblKDR.Caption := Extract(sTemp, 'KDR');
      lblEXP.Caption := Extract(sTemp, 'Experience');
      lblRank.Caption := Extract(sTemp, 'Ranking');
      lblStreak.Caption := Extract(sTemp, 'Streak');
      lblGP.Caption := Extract(sTemp, 'GP');
      lblHS.Caption := Extract(sTemp, 'HS');
      lblEnlisted.Caption := Extract(sTemp, 'Enlisted');
    
    end;
    
    Procedure TForm1.GetStatus(const UserName: String);
    var
      sString: String;
      msPicture: TStream;
      pngPicture: TPngImage;
    begin
      msPicture := TMemoryStream.Create;
      pngPicture := TPngImage.Create;
      try
        sString := IdHTTP1.Get('http://www.thecaconline.net/cbl/player/' +
          Pchar(UserName) + '.html');
        if ((AnsiContainsStr(sString, 'dirty.png')) or
          (AnsiContainsStr(sString, 'clean.png'))) then
        begin
          if AnsiContainsStr(sString, 'clean.png') then
            imgStatus.Picture := Image2.Picture
          else
            imgStatus.Picture := Image1.Picture;;
    
          IdHTTP1.Get
            ('http://combat.nexon.net/Avatar/MyAvatar.srf?GameName=CombatArms&CharacterID='
            + Pchar(UserName), msPicture);
          msPicture.Seek(0, soFromBeginning);
          pngPicture.LoadFromStream(msPicture);
          imgUser.Picture.Assign(pngPicture);
          ParseStats(sString);
        end
        else
          Showmessage('User Not Found!!!');
    
      finally
        msPicture.Free;
        pngPicture.Free;
        lblSearching.Visible := False;
        IdHTTP1.Disconnect;
      end;
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      lblSearching.Visible := True;
      Application.ProcessMessages;
      GetStatus(Edit1.Text);
    end;
    
    end.
    as you can see I did'nt spend much time on making this, about 30 minutes all up and 20 minutes of that was working out a good extraction function it uses the Indy component to connect....

  2. The Following User Says Thank You to Departure For This Useful Post:

    iShockYouuu (01-14-2011)

  3. #2
    GodHack2's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    645
    Reputation
    38
    Thanks
    762
    My Mood
    Amused
    nice
    i made a similar thing using vb





    beat this bitches ^^^^^^^

    Current Stats : Bored :/


    Respect list :
    Crash !
    Gordon'
    Markoj

  4. #3
    ultahackers's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    139
    Reputation
    9
    Thanks
    73
    My Mood
    Amused
    Nce, this ++ advanced... nce job sir

  5. #4
    ac1d_buRn's Avatar
    Join Date
    Aug 2009
    Gender
    female
    Location
    CA Source Section
    Posts
    3,406
    Reputation
    157
    Thanks
    3,991
    My Mood
    Flirty
    You made that in about half hour? Nice mang.