Jump to content

Scripts for l2phx


Recommended Posts

Here I'm planned posted scripts for l2packetHack, and replanish of content.

Ferst script "warrior helper" Char warrior fallawing the main char and help him in a fight)

 

 

 

Capabilities:

1. Can fallaw the player

2. Help fight.

3. Can healing (HP pots).

4. For script it's not importantly that players in party, or not in party.

5. Working on same Interlude servers

 

Instruction:

1. Run packet hack

2. Run 2 client's of the game.

3. Ask the name of main charecter and support.

4. Carefully configure other constant's in script.

5.Run script

}

//######################## Section of configure######################################################

const

interlude = true;  // C6 - true,  C4 - false;

CommanderName = 'abc';          // nick of main charecter

AssistantName = 'def';          // nick of helper

CommanderBot = true;            // main it's bot or man

HPMedium = 70;                  // % when we must healing HP with pots

HPBottleID = 1061;              //  ItemID 1060=Lesser Healing Potion;    1061=Healing Potion;  1539=Greater Healing Potion;

DrinkDelay = 14;                // reapeat time (10 - 20 sec)

InvRazmer = 99;                  // Inventor from assistant -1 (if invetor 80, then writting 79, if 100, so writting 99)

//#################################################################################################

 

var

CommanderX, CommanderY, CommanderZ : integer;            // my stats

CommanderID, CommanderHP, CommanderMaxHP: integer;

 

AssistX, AssistY, AssistZ : integer;                    // stats helper

AssistID, AssistHP, AssistMaxHP: integer;

AssistMP, AssistMaxMP : integer;

AssistHPlevelProcent : integer;

 

TargetID : integer;

time1: integer;

Inventory: array[0..InvRazmer, 0..9] of integer;  // inventor (itemType1, ObjectID, ItemID, count, itemType2, CustType1, isEquipped, BodyPart, EnchantLevel, CustType2)

HPBottleObjID: integer;                          // ObjectID pots

HpBottleCount: integer;                          // how long pots

 

procedure Init; //begining when script started

begin

  CommanderID:= 0;        // zero all data

  CommanderX:= 0;

  CommanderY:= 0;

  CommanderZ:= 0;

  CommanderID:= 0;

  CommanderHP:= 0;

  CommanderMaxHP:= 0;

//  MyMP:= 0;

//  MyMaxMP:= 0;

  AssistID:= 0;

  AssistX:= 0;

  AssistY:= 0;

  AssistZ:= 0;

  AssistID:= 0;

  AssistHP:= 0;

  AssistMaxHP:= 0;

  AssistMP:= 0;

  AssistMaxMP:= 0;

  TargetID:=0;

  time1:=1;

  buf:= #$0F;                            //requiers packet of invetor and userinfo

  SendToServerEx(AssistantName);

  SendToServerEx(CommanderName);

end;

 

function Wait(var tick: integer;Timewait: Integer): Boolean; // сквозная проверка без остановки скрипта ©dmitry501, modifed by Sh00rGo

var

  t: integer;

begin

  result:=false;

  t:=Round(Time*86400);

  if t>(tick+Timewait) then begin

    if tick>0 then result:=true;

    tick:=t;

  end;

end;

 

//############################## Модуль работы с Инвентарем ###########################

procedure InventoryCreate;

var

  i,k, offset : integer;

begin

  if interlude then offset:= 8 else offset:=0;

  for i:=0 to InvRazmer do

    if (i<ReadH(4)) then begin

      Inventory[i,0]:=ReadH(i*(28+offset)+6);  // itemType1

      Inventory[i,1]:=ReadD(i*(28+offset)+8);  // ObjectId

      Inventory[i,2]:=ReadD(i*(28+offset)+12); // ItemID

      Inventory[i,3]:=ReadD(i*(28+offset)+16); // count

      Inventory[i,4]:=ReadH(i*(28+offset)+20); // itemType2

      Inventory[i,5]:=ReadH(i*(28+offset)+22); // CustType1

      Inventory[i,6]:=ReadH(i*(28+offset)+24); // isEquipped

      Inventory[i,7]:=ReadD(i*(28+offset)+26); // BodyPart

      Inventory[i,8]:=ReadH(i*(28+offset)+30); // EnchantLevel

      Inventory[i,9]:=ReadH(i*(28+offset)+32); // CustType2

    end else

      for k:=0 to 9 do Inventory[i,k]:=0; // забиваем нулями

end;

 

function GetInv(obj,up,down:integer): integer; // up и down не проверяются

  var // 0-itemType1, 1-ObjectId, 2-ItemID, 3-count, 4-itemType2, 5-CustType1, 6-isEquipped, 7-BodyPart, 8-EnchantLevel, 9-CustType2

    i: integer;

begin

  for i:=0 to InvRazmer do if (Inventory[i,up]=obj) then

  begin

    Result:=Inventory[i,down];

    exit;

  end;

  Result:=-1;

end;

 

procedure UseItemObjID(ItemObjID:integer);      //Использовать предмет с заданным ItemID

begin

  buf:=#$14;

  WriteD(ItemObjID);

  WriteD(0);

  SendToServerEx(AssistantName);;

end;

//############################################################################################

 

procedure AssistUserInfo;                  // обновление данных о ассистенте

var

  i:word;

begin

  AssistID:=ReadD(18);

  AssistX:=ReadD(2);

  AssistY:=ReadD(6);

  AssistZ:=ReadD(10);

  i:=22;

  ReadS(i);

  if interlude then i:=i+48 else i:=i+44;

  AssistMaxHP:=ReadD(i);

  AssistHP:=ReadD(i);

  AssistMaxMP:=ReadD(i);        // чисто информативно

  AssistMP:=ReadD(i);

//  i:=i+363;              пока не используется

//  MyMaxCP:=ReadD(i);

//  MyCP:=ReadD(i);

end;

 

procedure AssistStatusUpdate;      // обновление данных о ассистенте

var

  i:integer;

begin

  for i:=0 to ReadD(6)-1 do

  case pck[i*8+10] of

    #$09: AssistHP:=ReadD(i*8+14);

    #$0A: AssistMaxHP:=ReadD(i*8+14);

    #$0B: AssistMP:=ReadD(i*8+14);

    #$0C: AssistMaxMP:=ReadD(i*8+14);

//    #$21: MyCP:=ReadD(i*8+14);          пока не используется

//    #$22: MyMaxCP:=ReadD(i*8+14);

  end;

  if AssistMaxHP > 0 then AssistHPlevelProcent:= Round((AssistMaxHP/100)*HPMedium);

end;

 

procedure CommanderUserInfo;            //  обновление данных о себе

var

  i:word;

begin

  CommanderID:=ReadD(18);

  CommanderX:=ReadD(2);

  CommanderY:=ReadD(6);

  CommanderZ:=ReadD(10);

  i:=22;

  ReadS(i);

  if interlude then i:=i+48 else i:=i+44;

  CommanderMaxHP:=ReadD(i);

  CommanderHP:=ReadD(i);

end;

 

procedure Action;          // команда действия

begin

  buf:=#$04;                //action

  WriteD(TargetID);

  WriteD(AssistX);

  WriteD(AssistY);

  WriteD(AssistZ);

  WriteC(0);

  SendToServerEx(AssistantName);

end;

 

procedure DrinkBottle;          // пьем бутылки и следим за их количеством

begin

  if HPBottleCount > 0 then

  begin

    UseItemObjID(HPBottleObjID);

    dec (HPBottleCount);

  end;

end;

 

begin                  // Далее обработка входящих пакетов

if pck = '' then exit;

 

if (ConnectName = CommanderName) and FromServer then

  case pck[1] of

  #$04: if ReadS(22) = CommanderName then CommanderUserInfo;

  end;

 

if (ConnectName = AssistantName) and FromServer then

  case pck[1] of

  #$04: if ReadS(22) = AssistantName then AssistUserInfo;

  #$0E: if AssistID=ReadD(2) then    //  StatusUpdate:h(ObjectID)d(Attributes)

          begin

            AssistStatusUpdate;

            if (AssistHP > 0) and (AssistHP < AssistHPlevelProcent) then if Wait(time1, DrinkDelay) then DrinkBottle;    // пьем бутылки с интервалом в 19 сек

            if (AssistHP > 0) and (AssistHP > AssistHPlevelProcent) then time1:=1;

          end;

  #$1B: begin

          InventoryCreate;  // Инвентарь

          HPBottleObjID:= getinv(HPBottleID, 2,1);

          HPBottleCount:= getinv(HPBottleID, 2,3);

        end;

  //#$27: InventoryUpdate;

  end;

 

if (ConnectName = AssistantName) and FromServer and CommanderBot then

  case pck[1] of

  #$01: if CommanderID = ReadD(2) then

        begin

          TargetID:= CommanderID;

          Action; Action;

        end;

  #$05, #$60 : if CommanderID = ReadD(2) then            //Attack:d(AttackerID)d(TargetID)d(Damage)b(Flags)d(X)d(Y)d(Z)h(Hits)

          begin

          TargetID:= ReadD(6);

          Action; Action;

          end;

  end;

 

if (ConnectName = CommanderName) and FromClient and (not CommanderBot) then

  case pck[1] of

  #$01: begin

          TargetID:= CommanderID;

          Action; Action;

        end;

  #$04: begin

          TargetID:= ReadD(2);            //  Action:h(ObjectID)d(OriginX)d(OriginY)d(OriginZ)b(ActionID)

          Action;

        end;

  end;

 

end.

 

 

 

Level up script for the dragon

//auto level up for 'Hatchling of the Stars'

 

//******************************************************************************

// 1)call the dragon

//

// 2 - give the eat

//******************************************************************************

// When healer select taret , dragon attacked them ,if it's need in heal he healing himself

// after fight fallowing the healer

//******************************************************************************

 

//******************************************************************************

//                  const of the scripts

//******************************************************************************

const

    Owner='Sex_Driver';    //nick of the owner

    Pet='';                  //name of pet

var

    OwnerID, PetID, TargetID : Integer; //ID owner, pet, ID target

    CoordX, CoordY, CoordZ : String;  //coordination of the pet

    Cmd :String;                      //commands for pet

    CurHP, MaxHP, CurMP, MaxMP, i : Integer;

    tick: Integer;

    timerA: TTimer;

    timerB: TTimer;

    timerHP: TTimer;

    MagicAtck:boolean;

 

//******************************************************************************

//                          Подпрограммы

//******************************************************************************

//©dmitry501

//если ставить sleep() то скрипт останавливается на время, но и пакеты тоже

//не принимаются и не отправляются, так вот эта функция позваляет избежать этого

function Pause(Timewait: Integer):Boolean;

// сквозная проверка без остановки скрипта

var

    t : integer;

begin

    result:=false;

    t:= Round(Time*86400);

    if t>(tick+Timewait) then

      begin

        tick:=t;

        result:=true;

      end;

end;

 

//все сообщения ботов в приватном чате патилидера

//видны только нам

procedure Say(msg:string);

begin

  buf:=hstr('4A 00 00 00 00');

  WriteD(2);

  WriteS(ConnectName);

  WriteS(msg);

  SendToClientEx(Owner);

end;

 

procedure OnTimerA(Sender: TObject);

begin

    //пакет RequestActionUse;

    buf:=hstr('45 ED 03 00 00 00 00 00 00 00'); //магическая атака пета

    SendToServerEX(Owner);

    //Say('магическая атака пета');

end;

 

procedure OnTimerB(Sender: TObject);

begin

    //пакет RequestActionUse;

    buf:=hstr('45 10 00 00 00 00 00 00 00 00'); //атака пета

    SendToServerEX(Owner);

end;

 

procedure OnTimerHP(Sender: TObject);

begin

    buf:=hstr('45 EE 03 00 00 00 00 00 00 00'); //пет лечиться

    SendToServerEX(Owner);

end;

 

//******************************************************************************

//                Вызывается при включении скрипта

//******************************************************************************

procedure Init;

begin

    MagicAtck:=true; //магическая атака

    OwnerID:=0;

    PetID:=0;

    timerA:=TTimer.Create(nil);

    timerA.OnTimer:=@OnTimerA;

    timerA.enabled:=false;

    timerA.interval:=5000; //время отката магии пета

    timerB:=TTimer.Create(nil);

    timerB.OnTimer:=@OnTimerB;

    timerB.enabled:=false;

    timerB.interval:=5000; //время отката

    timerHP:=TTimer.Create(nil);

    timerHP.OnTimer:=@OnTimerHP;

    timerHP.enabled:=false;

    timerHP.interval:=2000; //время отката лечения пета

end;

 

//******************************************************************************

//                Вызывается при выключении скрипта

//******************************************************************************

procedure Free;

begin

    timerA.Free;

    timerB.Free;

    timerHP.Free;

end;

 

//******************************************************************************

//      Вызывается при приходе каждого пакета, если скрипт включен

//******************************************************************************

begin

  //не обрабатываем пустые пакеты

  if pck='' then exit;

 

  //если от сервака принят пакет с UserInfo

  if FromServer and (OwnerID=0) and (ConnectName=Owner) and (pck[1]=#$04) then begin

      //Запоминаем собственный ИД

      OwnerID:=ReadD(18);

      Say('Скрипт готов к работе!');

  end;

 

  //пакет Attack

  //атаковать, если хозяин напал на цель

  if FromServer and (ConnectName=Owner) and (pck[1]=#$05) and (OwnerID=ReadD(2)) then begin

      if (TargetID<>0) and (OwnerID<>TargetID) then begin

        if magicatck then begin

          buf:=hstr('45 ED 03 00 00 00 00 00 00 00'); //магическая атака пета

          SendToServerEX(Owner);

          Say('Атакую магией!');

          TimerA.enabled:=true;

          TimerB.enabled:=false;

          //Say('Включили таймер');

        end

        else begin

          Say('Атакую цель!');

          TimerB.enabled:=true;

          TimerA.enabled:=false;

        end;

      end;

  end;

 

  //пакет MagicSkillUse

  //атаковать, если хозяин напал на цель магией

  if FromServer and (ConnectName=Owner) and (pck[1]=#$48) and (OwnerID=ReadD(2)) then begin

      if (TargetID<>0) and (OwnerID<>TargetID) then begin

        if magicatck then begin

          buf:=hstr('45 ED 03 00 00 00 00 00 00 00'); //магическая атака пета

          SendToServerEX(Owner);

          Say('Атакую магией!');

          TimerA.enabled:=true;

          TimerB.enabled:=false;

          //Say('Включили таймер');

        end

        else begin

          Say('Атакую цель!');

          TimerB.enabled:=true;

          TimerA.enabled:=false;

        end;

      end;

  end;

 

  //пакет TargetSelect

  //если принят пакет со сменой таргета

  if FromServer and (ConnectName=Owner) and (pck[1]=#$a6) then begin

      //запоминаем ИД таргета для ассиста

      TargetID:=ReadD(2);

      //Say('Это ИД таргета.');

  end;

 

  //пакет TargetUnselected

  //командир отменил цель

  if FromServer and (ConnectName=Owner) and (pck[1]=#$2a) and (OwnerID=ReadD(2)) then begin

      TargetID:=0;

      buf:=hstr('45 11 00 00 00 00 00 00 00 00'); //stop current action

      SendToServerEX(Owner);

      //Say('Стоп!');

      TimerA.enabled:=false;

      TimerB.enabled:=false;

      //Say('Выключили таймер');

  end;

 

  //если от сервака принят пакет с PetInfo

  if FromServer and (PetID=0) and (ConnectName=Owner) and (pck[1]=#$b1) then begin

      //Запоминаем ИД пета

      PetID:=ReadD(6);

    //смещение переменное, зависит от имени Пета(LenName*2+2) и имени Чара(LenName*2+2)

    //126 байт до имени Пета(LenName*2+2) и имени Чара(LenName*2+2) после 20 байт (+1 начало CurHP)

    i:=126+(Length(Pet)*2+2)+(Length(Owner)*2+2)+20+1;

    CurHP:=ReadD(i);

    MaxHP:=ReadD(i);

    CurMP:=ReadD(i);

    MaxMP:=ReadD(i);

    if (CurHP<MaxHP)

      then TimerHP.enabled:=true

      else TimerHP.enabled:=false;

    if (CurMP<MaxMP/2) then MagicAtck:=false else MagicAtck:=true; //магическая атака

  end;

 

  //пакет PetStatusUpdate

  //проверяем на жизнь пета

  if FromServer and (ConnectName=Owner) and (pck[1]=#$b5) and (PetID=ReadD(6)) then begin

    //смещение переменное, зависит от имени Пета(LenName*2+2)

    //21 байт до имени Пета(LenName*2+2) после 8 байт (+1 начало CurHP)

    i:=21+(Length(Pet)*2+2)+8+1;

    CurHP:=ReadD(i);

    MaxHP:=ReadD(i);

    CurMP:=ReadD(i);

    MaxMP:=ReadD(i);

    //Say('Считываем параметры пета');

    if (CurHP<MaxHP)

        then TimerHP.enabled:=true

        else TimerHP.enabled:=false;

    if (CurMP<MaxMP/2) then MagicAtck:=false else MagicAtck:=true; //магическая атака

  end;

end.

It's for begin....

 

 

Link to comment
Share on other sites

Script working on Interlude or HB.Script for BD or SvS.

Thi{

AutoBD_SVS

Join party dancing or singing, and fallawing if it's important!

For the normal fallowing of the char writting something in chat , that bot remember ID of word.

 

name- nick BD or SvS

name2- nick who send party and which all must fallawing.

 

Run script only after all chercter is enter in game.

 

}

 

Const

 name2='my nick';

 name='nick BD or SvS';

 

 //ID of packets Kamael, HB, Gracia

 //from client's

 ACTION_ID = #$1F;

 REQUESTITEMLIST_ID = #$14;

 REQUESTANSWERJOINPARTY_ID = #$43;

 REQUESTWITHDRAWALPARTY_ID = #$44;

 REQUESTMAGICSKILLUSE_ID = #$39;

 REQUESTSOCIALACTION_ID = #$34;

 REQUESTSSKILLLIST_ID = #$50;

 //от сервера

 USERINFO_ID = #$32;

 ASKJOINPARTY_ID = #$39;  

 SAY2_ID = #$4A;

 SKILLLIST_ID = #$5F;

 MAGICSKILLLAUNCHED_ID = #$54;

 

 //ID packets Interlude

 //from client

{  ACTION_ID = #$04;

 REQUESTITEMLIST_ID = #$0F;

 REQUESTANSWERJOINPARTY_ID = #$2A;

 REQUESTWITHDRAWALPARTY_ID = #$2B;

 REQUESTMAGICSKILLUSE_ID = #$2F;

 REQUESTSOCIALACTION_ID = #$1B;

 REQUESTSSKILLLIST_ID = #$3F;

 //от сервера

 USERINFO_ID = #$04;

 ASKJOINPARTY_ID = #$39;  

 SAY2_ID = #$4A;

 SKILLLIST_ID = #$58;

 MAGICSKILLLAUNCHED_ID = #$76;   }

 

 

Var

 Msg : TMemo;

 FormMain : TForm; //Создаваемая форма

 useskill: TTimer;

 skills:string;

 skillid,skillidold:integer;

 party_have,iswork,skillhave:boolean;

 skillbase: array[1..200,0..3] of integer;

 SkillsName : TStringList;

 listbox1,listbox2: TListBox;

 GB1: TGroupBox;

 Button1,Button2,Button3,Button4: TButton;

 Lb1,Lb2: Tlabel;

 cb3:tcheckbox;

 myOID,myX,myY,myZ: integer;      

 targetOID:integer;

 

function Create_FormMain : TForm;

Var

 Yes : boolean;

begin

 Yes := FALSE;

 Result := TForm.Create(nil);

 

 Result.Caption     := 'AutoBD v.0.0.1';

 Result.Left        := 397;

 Result.Top         := 233;

 Result.Width       := 450;

 Result.Height      := 650;

 Result.FormStyle   := fsNormal;

 Result.Position    := poDesigned;

 Result.BorderStyle := bsSizeable;

 Result.BorderWidth := 0;

 Result.WindowState := wsNormal;

 Result.Color       := clBtnFace;

 Result.Font.Name   := 'Tahoma';

 Result.Font.Size   := 8;

 Result.Font.Color  := clWindowText;

 Result.Font.CharSet:= 1;

 Result.OnClose := @FormClose;

 

 Msg := TMemo.Create(Result);

 Msg.Parent := Result;

 Msg.Left    := 0;

 Msg.Top     := 400;

 Msg.Width   := 200;

 Msg.Height  := 200;

 Msg.Visible := TRUE;

 Msg.Tag     := 0;

 Msg.Enabled  := TRUE;

 Msg.Hint     := '';

 Msg.ShowHint := FALSE;

 Msg.Font.Name  := 'Tahoma';

 Msg.Font.Size  := 8;

 Msg.Font.Color := clWindowText;

 Msg.Color         := clWindow;

 Msg.TabOrder      := 2;

 Msg.TabStop       := TRUE;

 Msg.Align         := alBottom;

 Msg.WordWrap      := TRUE;

 Msg.Alignment     := taLeftJustify;

 Msg.WantTabs      := FALSE;

 Msg.WantReturns   := TRUE;

 Msg.HideSelection := TRUE;

 Msg.MaxLength     := 0;

 Msg.OEMConvert    := FALSE;

 Msg.ReadOnly      := FALSE;

 Msg.ScrollBars    := ssNone;

 

 GB1 := TGroupBox.Create(Result);

 GB1.Parent := result;

 GB1.Align         := alRight;

 GB1.Left    := 1;

 GB1.Top     := 2;

 GB1.Width   := 100;

 GB1.Height  := 95;

 GB1.Visible := TRUE;

 GB1.Tag     := 0;

 GB1.Enabled  := TRUE;

 GB1.Hint     := '';

 GB1.ShowHint := FALSE;

 GB1.Caption    := 'НЕПРИНИМАЕТ ПАТИ';

 GB1.Align      := alTOP;

 GB1.Color      := clBtnFace;

 GB1.Font.Name  := 'Tahoma';

 GB1.Font.Size  := 8;

 GB1.Font.Color := clWindowText;

 GB1.Font.CharSet := 1;

 GB1.TabOrder     := 3;

 GB1.TabStop      := FALSE;

 

 listbox1 := Tlistbox.Create(Result);

 listbox1.Parent := Result;

 listbox1.Left    := 0;

 listbox1.Top     := 100;

 listbox1.Width   := 180;

 listbox1.Height  := 200;

 listbox1.Visible := TRUE;

 listbox1.Tag     := 0;

 listbox1.Enabled  := TRUE;

 listbox1.Hint     := '';

 listbox1.ShowHint := FALSE;

 listbox1.Font.Name  := 'Tahoma';

 listbox1.Font.Size  := 8;

 listbox1.Font.Color := clWindowText;

 listbox1.Color         := clWindow;

 listbox1.TabOrder      := 2;

 listbox1.TabStop       := TRUE;

 listbox1.Align         := alLeft;

 listbox1.OnDblClick :=@button3click;

 

 listbox2 := Tlistbox.Create(Result);

 listbox2.Parent := Result;

 listbox2.Left    := 0;

 listbox2.Top     := 100;

 listbox2.Width   := 180;

 listbox2.Height  := 200;

 listbox2.Visible := TRUE;

 listbox2.Tag     := 0;

 listbox2.Enabled  := TRUE;

 listbox2.Hint     := '';

 listbox2.ShowHint := FALSE;

 listbox2.Font.Name  := 'Tahoma';

 listbox2.Font.Size  := 8;

 listbox2.Font.Color := clWindowText;

 listbox2.Color         := clWindow;

 listbox2.TabOrder      := 2;

 listbox2.TabStop       := TRUE;

 listbox2.Align         := alRight;

 listbox2.OnDblClick :=@button4click;

 

 Button1 := TButton.Create(Result);

 Button1.Parent := gb1;

 Button1.Left    := 10;

 Button1.Top     := 30;

 Button1.Width   := 75;

 Button1.Height  := 25;

 Button1.Visible := TRUE;

 Button1.Tag     := 0;

 Button1.Enabled  := true;

 Button1.Hint     := '';

 Button1.ShowHint := FALSE;

 Button1.Caption    := 'Вкл';

 Button1.Font.Name  := 'Tahoma';

 Button1.Font.Size  := 8;

 Button1.Font.Color := clWindowText;

 Button1.Font.CharSet := 1;

 Button1.TabOrder     := 1;

 Button1.TabStop      := TRUE;

 Button1.Cancel       := FALSE;

 Button1.ModalResult  := 0;

 Button1.OnClick     := @Button1click;

 

 Button2 := TButton.Create(Result);

 Button2.Parent := gb1;

 Button2.Left    := 100;

 Button2.Top     := 30;

 Button2.Width   := 75;

 Button2.Height  := 25;

 Button2.Visible := TRUE;

 Button2.Tag     := 0;

 Button2.Enabled  := true;

 Button2.Hint     := '';

 Button2.ShowHint := FALSE;

 Button2.Caption    := 'Выкл';

 Button2.Font.Name  := 'Tahoma';

 Button2.Font.Size  := 8;

 Button2.Font.Color := clWindowText;

 Button2.Font.CharSet := 1;

 Button2.TabOrder     := 1;

 Button2.TabStop      := TRUE;

 Button2.Cancel       := FALSE;

 Button2.ModalResult  := 0;

 Button2.OnClick     := @Button2click;

 

 Button3 := TButton.Create(Result);

 Button3.Parent := result;

 Button3.Left    := 200;

 Button3.Top     := 140;

 Button3.Width   := 40;

 Button3.Height  := 25;

 Button3.Visible := TRUE;

 Button3.Tag     := 0;

 Button3.Enabled  := True;

 Button3.Hint     := '';

 Button3.ShowHint := FALSE;

 Button3.Caption    := '>>>>';

 Button3.Font.Name  := 'Tahoma';

 Button3.Font.Size  := 8;

 Button3.Font.Color := clWindowText;

 Button3.Font.CharSet := 1;

 Button3.TabOrder     := 1;

 Button3.TabStop      := TRUE;

 Button3.Cancel       := FALSE;

 Button3.ModalResult  := 0;

 Button3.OnClick     := @button3click;

 

 Button4 := TButton.Create(Result);

 Button4.Parent := result;

 Button4.Left    := 200;

 Button4.Top     := 220;

 Button4.Width   := 40;

 Button4.Height  := 25;

 Button4.Visible := TRUE;

 Button4.Tag     := 0;

 Button4.Enabled  := True;

 Button4.Hint     := '';

 Button4.ShowHint := FALSE;

 Button4.Caption    := '<<<<';

 Button4.Font.Name  := 'Tahoma';

 Button4.Font.Size  := 8;

 Button4.Font.Color := clWindowText;

 Button4.Font.CharSet := 1;

 Button4.TabOrder     := 1;

 Button4.TabStop      := TRUE;

 Button4.Cancel       := FALSE;

 Button4.ModalResult  := 0;

 Button4.OnClick     := @button4click;

 

 Lb1:= Tlabel.Create(result);

 Lb1.Parent := GB1;

 Lb1.Left    := 140;

 Lb1.Top     := 30+200;

 Lb1.Align         := alLeft;

 Lb1.Layout     := tlBottom;

 Lb1.Visible := TRUE;

 Lb1.Tag     := 0;

 Lb1.Enabled  := TRUE;

 Lb1.Hint     := '';

 Lb1.ShowHint := FALSE;

 Lb1.Caption    := 'Все Скилы';

 Lb1.Font.Name  := 'Tahoma';

 Lb1.Font.Size  := 10;

 Lb1.Font.Color := clWindowText;

 Lb1.Font.CharSet := 1;

 

 Lb2:= Tlabel.Create(result);

 Lb2.Parent := GB1;

 Lb2.Left    := 140;

 Lb2.Top     := 30+200;

 Lb2.Align         := alRight;

 Lb2.Layout     := tlBottom;

 Lb2.Visible := TRUE;

 Lb2.Tag     := 0;

 Lb2.Enabled  := TRUE;

 Lb2.Hint     := '';

 Lb2.ShowHint := FALSE;

 Lb2.Caption    := 'Те которые использовать';

 Lb2.Font.Name  := 'Tahoma';

 Lb2.Font.Size  := 10;

 Lb2.Font.Color := clWindowText;

 Lb2.Font.CharSet := 1;

 

 cb3:= TCheckbox.Create(result);

 cb3.Parent := GB1;

 cb3.Left    := 220;

 cb3.Top     := 60;

 cb3.Width   := 220;

 cb3.Checked := TRUE;

 cb3.Visible := TRUE;

 cb3.Tag     := 0;

 cb3.Enabled  := TRUE;

 cb3.Hint     := '';

 cb3.ShowHint := FALSE;

 cb3.Caption    := 'Следовать послы выхода из пати';

 cb3.Font.Name  := 'Tahoma';

 cb3.Font.Size  := 10;

 cb3.Font.Color := clWindowText;

 cb3.Font.CharSet := 1;

 

 Yes := TRUE;

 

 Result.Show;

 msg.Lines.Add(timetostr(now)+': '+'Autodance, by Ad');

 msg.Lines.Add(timetostr(now)+': '+'Работаем с чаром: '+Name);

 

end;

 

procedure button1click(Sender: TButton);

begin

 iswork:=true;

 GB1.Caption    := 'ПРИНИМАЕТ ПАТИ';

end;

 

procedure button2click(Sender: TButton);

begin

 iswork:=false;

 GB1.Caption    := 'НЕПРИНИМАЕТ ПАТИ';

end;

 

procedure perreshet;

var i:integer;

str:string;

begin

str:='';

for i:=1 to ListBox2.items.Count do

    begin

    str:=str+Copy(ListBox2.Items.Strings[i-1],1+pos(':',ListBox2.Items.Strings[i-1]),pos(' ',ListBox2.Items.Strings[i-1])-4)+':';

    end;

skills:=str;

end;

 

procedure button3click(Sender: TButton);

var m:integer;

begin

 

if ListBox1.Items.Count>0 then

  begin

  m:=ListBox1.ItemIndex;

  if (ListBox1.Items.Count=1) then m:=0

  else

  if m=ListBox1.Items.Count-1 then dec(m);

 

  ListBox2.Items.Add(ListBox1.Items.Strings[ListBox1.ItemIndex]);

  ListBox1.Items.Delete(ListBox1.ItemIndex);

  ListBox1.ItemIndex:=m;

  perreshet;

  end;

 

end;

 

procedure Button4Click(Sender: TObject);

var m:integer;

begin

 

if ListBox2.Items.Count>0 then

  begin

  m:=ListBox2.ItemIndex;

  if (ListBox2.Items.Count=1) then m:=0

  else

  if m=ListBox2.Items.Count-1 then dec(m);

 

  ListBox1.Items.Add(ListBox2.Items.Strings[ListBox2.ItemIndex]);

  ListBox2.Items.Delete(ListBox2.ItemIndex);

  ListBox2.ItemIndex:=m;

  perreshet;

end;

 

end;

 

procedure FormClose(Sender: TObject; var Action: TCloseAction);

begin

 Action:=caNone;

end;

 

procedure Free_FormMain;

begin

 TRY

   if FormMain<>NIL then begin

      FormMain.Free;

      FormMain:=NIL;

   end;

 FINALLY

 END;

end;

 

procedure SendMesg(msg:string);  //отправка сообщений клиенту

begin

buf:=SAY2_ID;

 WriteD(0);

 WriteD(2);

 WriteS('->БОГ');

 WriteS(msg);

 SendToClientEx(Name);

end;

 

procedure Init; //Вызывается при включении скрипта

begin

 

skillsName:=TStringList.Create;

try

 skillsName.LoadFromFile('.\settings\SkillsID.ini');

 except

   msg.Lines.Add('itemsid.ini не найден!');

   exit;

 end;

 

skillid:=0;

iswork:=false;

useskill:=TTimer.Create(nil);

useskill.OnTimer:=@timerskill;

useskill.interval:=200; //время задержки

useskill.enabled:=true;

skillhave:=false;

party_have:=false;

FormMain:=Create_FormMain;

buf:=REQUESTSSKILLLIST_ID;

SendToServerEx(name);

 

buf:=REQUESTITEMLIST_ID;

SendToServerEx(name);

 

end;

 

procedure timerskill;

begin

if skillid<>0 then

begin

  msg.lines.add('Юзаю скилл');

  MagicSkillUse(skillid);

  skillidold:=skillID;

  skillID:=0;

end;

 

end;

 

procedure Free; //Вызывается при выключении скрипта

begin

useskill.free;

Free_FormMain;

end;

 

procedure UserInfo; //обновление данных о себе

var

 i:word;

begin

 MyOID:=ReadD(18);

 MyX:=ReadD(2);

 MyY:=ReadD(6);

 MyZ:=ReadD(10);

end;

 

procedure MagicSkillUse(MagicID:integer);

begin

 buf:=REQUESTMAGICSKILLUSE_ID;

 WriteD(MagicID);

 WriteD(00);

 WriteC(00);

 SendToServerEx(Name);

end;

 

procedure createskillbase;

var

i, j,n: integer;

begin

 for i:=1 to 200 do begin

   skillbase[i,0]:=0;

   skillbase[i,1]:=0;

   skillbase[i,2]:=0;

 end;

 n:=0;

 J:=6;

 I:=1;

 listbox1.items.Clear;

 while I<200 do

 begin

   skillbase[i,0]:=ReadD(j);

   skillbase[i,1]:=ReadD(j);

   skillbase[i,2]:=ReadD(j);

 if skillbase[i,2]=0 then break;

   j:=j+1;

   inc(n);

   if skillbase[i,0]=0 then

   listbox1.items.Add('ID:'+inttostr(skillbase[i,2])+'   '+SkillsName.Values[intToStr(skillbase[i,2])]+'  LVL:'+inttostr(skillbase[i,1]));

   inc(i);

 end;

 if N>0 then skillhave:=true;

 

end;

 

procedure Target(Attacker: Integer);

begin

 buf:=ACTION_ID;

 WriteD(Attacker);

 WriteD(MyX);

 WriteD(MyY);

 WriteD(MyZ);

 WriteC(00);

 SendToServerEx(Name);

end;

 

procedure TargetAttacker(Attacker: Integer);

begin

 if Attacker<>0 then begin

   msg.Lines.Add('Attacker='+IntToStr(Attacker)+' Player='+IntToStr(MyOID));

   Target(Attacker);

   delay(800);

   Target(Attacker);

   delay(800);

   Target(Attacker);

 end;

end;

       

procedure buffok;

begin

 if ReadD(6)=skillIDold then begin

   msg.lines.add('Прописываем следующий скилл');

   if Length(skills)>0 then begin

     skillID:=strtoint(Copy(Skills,1,pos(':',Skills)-1));

     delete(Skills,1,pos(':',Skills));

   end else

     if  party_have=true then begin

       if cb3.Checked=true then

          begin

          msg.lines.add('Cледуем за '+name2);

          TargetAttacker(targetOID);

          end;

       msg.lines.add('Разрываем пати');

       delay(200);

       buf:=REQUESTWITHDRAWALPARTY_ID;

       SendToServerEx(name);

       party_have:=false;

     end;

 end;

end;

 

var

 temp : String;

 

begin

 if pck='' then exit;

 if (LowerCase(ConnectName)=LowerCase(Name)) and FromClient then

   case pck[1] of

   REQUESTSOCIALACTION_ID:

       case ReadD(2) of

         //социальное действие Yes для старта

         6: begin

            iswork:=true;

            GB1.Caption:= 'ПРИНИМАЕТ ПАТИ';

            end;

         //социальное действие No для остановки

          5: begin

             iswork:=false;

             GB1.Caption:= 'НЕПРИНИМАЕТ ПАТИ';

             end;

       end;

   end;

 

if (ConnectName=Name) and FromServer then

begin

        case pck[1] of

        ASKJOINPARTY_ID: if iswork then

             begin

               temp:=ReadS(2);

               if LowerCase(temp)=LowerCase(name2) then

                 begin

                 perreshet;

                 Delay(100);

                 buf:=REQUESTANSWERJOINPARTY_ID+HStr('01 00 00 00');

                 SendToServerEx(name);

                 msg.Lines.Add('Принимаю пати');

                 party_have:=true;

                 Delay(200);

                 if Length(skills)>0 then

                   begin

                   msg.Lines.Add('Прописываю скилл');

                   skillID:=strtoint(Copy(Skills,1,pos(':',Skills)-1));

                   delete(Skills,1,pos(':',Skills));

                   end;

                 pck:='';

                 end else msg.Lines.Add('Проигнорирован запрос пати от: '+temp);

             end;

 

        MAGICSKILLLAUNCHED_ID:  begin

                                if (MyOID=ReadD(2)) then buffok;

                                end;

        USERINFO_ID:  begin //пакет с инфой о моём чаре

                      UserInfo;

                      end;

        SAY2_ID:  begin //пакет с инфой о том за кем бежать

                  if LowerCase(ReadS(10))=LowerCase(name2) then

                    begin

                    TargetOID:=ReadD(2);

                    msg.lines.add('Нашли цель следовния: '+inttostr(TARGETOID));

                    end;

                 end;

        SKILLLIST_ID:  begin

                       if skillhave=false then createskillbase;

                       end;

           end;

end;

 

end.

Link to comment
Share on other sites

  • 2 weeks later...

Script for lvl up when you chage sub class.

 

begin

 

if FromClient and (pck=Hstr('packet of sub clas change - sniffed yourself')) then

begin

buf:=pck;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

delay(1);

buf:=#$46;

SendToServer;

 

end;

end.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...