Показать сообщение отдельно
Старый 15.04.2009, 16:23   #12
Местный
 
Аватар для PanAm
 
Регистрация: 18.01.2008
Сообщений: 286
Сказал Спасибо: 24
Имеет 133 спасибок в 80 сообщенях
PanAm
По умолчанию

Вот немного подредактировал скрипт (да простит меня автор)
Логику не менял, только переписал для более удобного портирования на различные хроники.
delphi Код:
{ AutoBD_SVS by Ad Принимает пати танцует или поет, и следует по необходимости! Для того чтобы нормально следовал за целью, нужно основным чаром что нибудь в чат написать, чтобы запомнился айди. name- ник БД или СВСа name2- ник того перса который будет кидать пати и за кем будет следовать БД или СВС. Запускать скрипт ТОЛЬКО ПОСЛЕ того как БД или СВС уже вошел в игру. } Const   name2='МойНик';   name='никБДилиСВС';     //ID пакетов   //От клиента   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,1..2] 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,1]:=0;     skillbase[i,2]:=0;   end;   n:=0;   J:=10;   listbox1.items.Clear;   for I:=1 to 200 do begin     skillbase[i,1]:=ReadD(j);     skillbase[i,2]:=ReadD(j);     if skillbase[i,2]=0 then break;     j:=j+5;     inc(n);     listbox1.items.Add('ID:'+inttostr(skillbase[i,2])+'   '+SkillsName.Values[IntToStr(skillbase[i,2])]+'  LVL:'+inttostr(skillbase[i,1]));   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);   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         msg.lines.add('Cледуем за '+name2);         if cb3.Checked=true then           TargetAttacker(targetOID);         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 (ConnectName=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 temp=name2 then                   begin                   perreshet;                   Delay(100);                   buf:=REQUESTANSWERJOINPARTY_ID+#$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 ReadS(10)=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.
PanAm вне форума   Ответить с цитированием
За это сообщение PanAm нажился 5 спасибками от: