unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
const
BATTLELIST_START = $005F7994;
BATTLELIST_END = $005FD460;
PLAYER_X = $00602B08;
PLAYER_Y = $00602B04;
PLAYER_Z = $00602B00;
PLAYER_LEVEL = $005F7920;
PLAYER_EXP = $00605A04; // zmieniony - Tibia 7.9
STATUS_TEXT = $0074F1D0;
STATUS_TIMER = $0074F1CC;
SPEED_USE = $0074DBD0;
implementation
function ExpToLevel(Level: Integer): Integer;
begin
Result := Round(50/3*Power(Level,3) - 100*Power(Level,2) + 850/3*Level - 200);
end;
function CalculateLeftExp: string;
var
Tibia: Cardinal;
AExp, ALevel, ANextLevelExp, AExpLeft: Cardinal;begin
{Obliczamy zawartość zmiennych}
Tibia := FindWindow('TibiaClient',nil);
AExp := MemoryReadInt(Tibia,PLAYER_EXP,Len,Rdd);
ALevel := MemoryReadInt(Tibia,PLAYER_LEVEL,Len,Rdd);
ANextLevelExp := ExpToLevel(ALevel+1);
AExpLeft := ANextLevelExp-AExp;
{Formatujemy wyjściowy ciąg tekstowy}
Result := Format('Level: %d. Ilość exp.: %d. Pozostały exp. do levelu %d: %d.',[ALevel,AExp,ALevel+1,AExpLeft]);
end;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Tibia: Cardinal;
begin
Tibia := FindWindow('TibiaClient',nil);
SetWindowText(Tibia,PChar('Tibia <<Mój Bot>>'));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ShowMessage(CalculateLeftExp);
end;
end.
Zakładki