Forum in READ ONLY mode! All questions and discussions on Discord official server, invite link: https://discord.gg/VxsGzJ7

Работа с Bulk Order Book

Only working scripts
Post Reply
shinma
Expert
Expert
Posts: 505
Joined: 28.04.2011 12:05

Работа с Bulk Order Book

Post by shinma »

Это наглядный пример как работать с Bulk Order Book.
В игре откройте любую Bulk Order Book и запустите это скрипт.
В журнал стелса будет выведено содержание текущей страницы Bulk Order Book. Конкретно -содержание бодов, маленьких и больших.

Ну и как всегда большое спасибо Vizit0r за помощь в выполнении основного скрипта.

скрипт выводит информацию типа:

Small bone arms exceptional Leather 0 / 10
Small shoes exceptional Leather 0 / 20
Small thigh boots exceptional Leather 0 / 20
--------------------------------------
Large 4
skullcap exceptional Cloth 0 / 20
doublet exceptional Cloth 0 / 20
kilt exceptional Cloth 0 / 20
shoes exceptional Leather 0 / 20
--------------------------------------
Small bone leggings exceptional Leather 0 / 10

А что можно делать с этим дальше напишу позже.

Code: Select all

Program Gump;
const LineHeightConst = 32;
     //
type TBod = record
  BodType : String;
  DropButton_Return_Value :Integer;
  Item : String;
  Quality : String;
  Material : String;
  Amount : String;
  Price : String;
end;

type TLargeBod = record
  BodsCount : integer;
  Bods : array of TBod;
end;

TBookElem = record
  BodType : integer;
  SmallBod : TBod;
  LargeBod : TLargeBod;
end;

TBodBook = array of TBookElem;


    var
    i,k,j,m : Integer;
    GI: TGumpInfo;
    CurrLineY : Word;
    LargeBod : TLargeBod;
    Bod : TBod;
    BodBook : TBodBook;
    FoundElem : Boolean ;
    ClilocG : String;

   
procedure  bodliker;   

  begin
    FoundElem:= False;
    if (GetGumpsCount = 0) or (GetGumpID(GetGumpsCount-1) <> $29C) then
    Exit;
    GetGumpInfo(GetGumpsCount-1,GI);
    if Length(GI.XmfHTMLGumpColor) > 0 then
    for I := 0 to Length(GI.XmfHTMLGumpColor) - 1 do
      begin
      ClilocG:=GetClilocById(GI.XmfHTMLGumpColor[i].Cliloc_id);
      if  ClilocG = 'Drop' then //caption line
        begin //title String. Incr it's Y to LineHeightConst and take 1st line
        CurrLineY := GI.XmfHTMLGumpColor[i].y + LineHeightConst; //1st line
        Break;
        end;
      end;  
    if CurrLineY = 0  then
    Exit;
  while True do
    begin
    Bod.DropButton_Return_Value := $FFFF;
    for k := 0 to Length(GI.GumpButtons) - 1 do   
    for j:=0 to 35 do
    if (GI.GumpButtons[k].y - 2 = CurrLineY) and (GI.GumpButtons[k].x =j ) then
      begin
      Bod.DropButton_Return_Value := GI.GumpButtons[k].return_value;
      Break;
      end;

    FoundElem := False;
    for k := 0 to Length(GI.XmfHTMLGumpColor) - 1 do
    if GI.XmfHTMLGumpColor[k].y = CurrLineY then
      begin
      FoundElem := True;
        case GI.XmfHTMLGumpColor[k].x of
          40..65  : Bod.BodType := GetClilocByID(GI.XmfHTMLGumpColor[k].Cliloc_id);
          66..105 : Bod.Item := GetClilocByID(GI.XmfHTMLGumpColor[k].Cliloc_id);
          106..240: Bod.Quality := GetClilocByID(GI.XmfHTMLGumpColor[k].Cliloc_id);
          241..320: Bod.Material := GetClilocByID(GI.XmfHTMLGumpColor[k].Cliloc_id);
         else
        FoundElem := False; 
        end;
        if (LowerCase(GetClilocByID(GI.XmfHTMLGumpColor[k].Cliloc_id)) = 'previous page')
        or (LowerCase(GetClilocByID(GI.XmfHTMLGumpColor[k].Cliloc_id)) = 'next page') then
        FoundElem := False;
        end;
    if not FoundElem and (Bod.DropButton_Return_Value = $FFFF) then
      Break; //Last Line, Exit;

    for k := 0 to Length(GI.GumpText) - 1 do
    if GI.GumpText[k].y = CurrLineY then
      case GI.GumpText[k].x of
        320..425 : Bod.Amount := GI.Text[GI.GumpText[k].text_id];
        426..500 : Bod.Price := GI.Text[GI.GumpText[k].text_id];
      end;
    if Bod.BodType = 'Small' then
      begin
      if Length(LargeBod.Bods) > 0 then //Large Bod finished, adding it to Book
        begin
          SetLength(BodBook,Length(BodBook) +1 );
          BodBook[Length(BodBook)-1].BodType := 1;
          BodBook[Length(BodBook)-1].LargeBod := LargeBod;
          SetLength(LargeBod.Bods,0);  
          LargeBod.BodsCount := 0;
        end;
      SetLength(BodBook,Length(BodBook) +1 );
      BodBook[Length(BodBook)-1].BodType := 0;
      BodBook[Length(BodBook)-1].SmallBod := Bod;
      end
    else
      begin  
         if (Length(LargeBod.Bods) > 0) and (Bod.DropButton_Return_Value < $FFFF) then //Large Bod finished, adding it to Book
        begin
        SetLength(BodBook,Length(BodBook) +1 );
        BodBook[Length(BodBook)-1].BodType := 1;
        BodBook[Length(BodBook)-1].LargeBod := LargeBod;
        SetLength(LargeBod.Bods,0);
        LargeBod.BodsCount := 0;
        end;
        Inc(LargeBod.BodsCount);
        SetLength(LargeBod.Bods,Length(LargeBod.Bods) +1 );
        LargeBod.Bods[Length(LargeBod.Bods) - 1] := Bod; 
      end; 
    CurrLineY:=CurrLineY+ LineHeightConst;
    end; 
    if (Length(LargeBod.Bods) > 0) then //Large Bod finished, adding it to Book
        begin
        SetLength(BodBook,Length(BodBook) +1 );
        BodBook[Length(BodBook)-1].BodType := 1;
        BodBook[Length(BodBook)-1].LargeBod := LargeBod;
        end;
end;
     
   
begin
bodliker;
if Length(BodBook)>10 then m:=10 else
m:= Length(BodBook); 
for j:= 0 to m-1 do
begin
if BodBook[j].BodType=0 then
AddToSystemJournal(BodBook[j].SmallBod.BodType+' '+BodBook[j].SmallBod.Item+' '+
BodBook[j].SmallBod.Quality+' '+ BodBook[j].SmallBod.Material+' '+BodBook[j].SmallBod.Amount);
if BodBook[j].BodType>0 then
begin
AddToSystemJournal('--------------------------------------');
AddToSystemJournal(BodBook[j].LargeBod.Bods[0].BodType+' '+inttostr(Length(BodBook[j].LargeBod.Bods)));
for i:=0 to Length(BodBook[j].LargeBod.Bods)-1 do
begin
AddToSystemJournal(BodBook[j].LargeBod.Bods[i].Item+' '+
BodBook[j].LargeBod.Bods[i].Quality+' '+
BodBook[j].LargeBod.Bods[i].Material+' '+
BodBook[j].LargeBod.Bods[i].Amount);
end;
AddToSystemJournal('--------------------------------------');
end;

end;

end.
Last edited by shinma on 07.10.2013 17:26, edited 2 times in total.
--->>>ПОИСК ПО ФОРУМУ, НАЧНИ С НЕГО!!!<<<---
--->>>Search the forum, start with him!!!<<<---
95% Ваших вопросов уже кем-то написаны и решены.
shinma
Expert
Expert
Posts: 505
Joined: 28.04.2011 12:05

Re: Работа с Bulk Order Book

Post by shinma »

Предыдущий скрипт был кривой. Но визитор нашел проблему. Собственно первый пост обновил с уже исправленным кодом.
--->>>ПОИСК ПО ФОРУМУ, НАЧНИ С НЕГО!!!<<<---
--->>>Search the forum, start with him!!!<<<---
95% Ваших вопросов уже кем-то написаны и решены.
Half-Life
Novice
Novice
Posts: 86
Joined: 30.10.2012 12:06
Location: Одесса
Contact:

Re: Работа с Bulk Order Book

Post by Half-Life »

shinma wrote: А что можно делать с этим дальше напишу позже.
Пора бы уже рассказать) мне например интересно)
Tomers
Novice
Novice
Posts: 99
Joined: 06.08.2009 11:51

Re: Работа с Bulk Order Book

Post by Tomers »

Half-Life wrote:
shinma wrote: А что можно делать с этим дальше напишу позже.
Пора бы уже рассказать) мне например интересно)
А что тут рассказывать? Дальше крафтим боды, собираем большие, сдаем, получаем реварды. У меня такой скрипт уже как год написан.
Post Reply