Помогите! Продажа инготов НПЦ
Posted: 19.02.2015 20:14
				by Envy
				Сегодня, из нескольких найденных на форуме скриптов, слепил нужный мне, но работает он не так как хотелось бы. Задача скрипта - впарить НПЦу инги, чтоб стоимость одной сделки не превышала 50к гп. У чара полный пак различных ингов весом в пару сотен тысяч. Отношение цена/количество я завел в массив. Как сделать, чтоб он продавал только один тип/цвет за раз, а не как сейчас все сразу?  
			 Скрипт  
 Code: Select all
Program sell_ingots;
{$Include 'all.inc'} 
type toreinfo = record
  name: string;
  qnty: word;
  ingotColor: word;
  ingotType: word;
end;
type tloginfo = record
  name: string;
  color: word;
end;
var
  cnt_gold, i, k : integer; 
  TimeStart : TDateTime;
  oreInfo: array of toreinfo;
  
procedure initingots;
  begin
    setlength(oreInfo, 30);
    oreInfo[0].name :=       'Iron       ';
    oreInfo[0].qnty :=        999;
    oreInfo[0].ingotColor :=  $0000;
    oreInfo[0].ingotType :=   $1BEF;
    ////////////
    oreInfo[1].name :=       'Rusty      ';
    oreInfo[1].qnty :=        999;
    oreInfo[1].ingotColor :=  $0750;
    oreInfo[1].ingotType :=   $1BEF;
    ////////////
    oreInfo[2].name :=       'Old Copper ';
    oreInfo[2].qnty :=        999;
    oreInfo[2].ingotColor :=  $0590;
    oreInfo[2].ingotType :=   $1BEF;
    ////////////
    oreInfo[3].name :=       'Dull Copper';
    oreInfo[3].qnty :=        999;
    oreInfo[3].ingotColor :=  $060A;
    oreInfo[3].ingotType :=   $1BEF;
    ////////////
    oreInfo[4].name :=       'Copper     ';
    oreInfo[4].qnty :=        999;
    oreInfo[4].ingotColor :=  $0000;
    oreInfo[4].ingotType :=   $1BE3;
    ////////////
    oreInfo[5].name :=       'Bronze     ';
    oreInfo[5].qnty :=        999;
    oreInfo[5].ingotColor :=  $0488;
    oreInfo[5].ingotType :=   $1BEF;
    ////////////
    oreInfo[6].name :=       'Silver     ';
    oreInfo[6].qnty :=        999;
    oreInfo[6].ingotColor :=  $0000;
    oreInfo[6].ingotType :=   $1BF5;
    ////////////
    oreInfo[7].name :=       'Gold       ';
    oreInfo[7].qnty :=        999;
    oreInfo[7].ingotColor :=  $0000;
    oreInfo[7].ingotType :=   $1BE9;
    ////////////
    oreInfo[8].name :=       'Shadow     ';
    oreInfo[8].qnty :=        999;
    oreInfo[8].ingotColor :=  $096B;
    oreInfo[8].ingotType :=   $1BEF;
    ////////////
    oreInfo[9].name :=       'Rose       ';
    oreInfo[9].qnty :=        980;
    oreInfo[9].ingotColor :=  $0014;
    oreInfo[9].ingotType :=   $1BEF;
    ////////////
    oreInfo[10].name :=      'Agapite    ';
    oreInfo[10].qnty :=       735;
    oreInfo[10].ingotColor := $0193;
    oreInfo[10].ingotType :=  $1BEF;
    ////////////
    oreInfo[11].name :=      'Blood rock ';
    oreInfo[11].qnty :=       588;
    oreInfo[11].ingotColor := $04C2;
    oreInfo[11].ingotType :=  $1BEF;
    ////////////
    oreInfo[12].name :=      'Verite     ';
    oreInfo[12].qnty :=       490;
    oreInfo[12].ingotColor := $07D5;
    oreInfo[12].ingotType :=  $1BEF;
    ////////////
    oreInfo[13].name :=      'Valorite   ';
    oreInfo[13].qnty :=       367;
    oreInfo[13].ingotColor := $00CE;
    oreInfo[13].ingotType :=  $1BEF;
    ////////////
    oreInfo[14].name :=      'Mitheril   ';
    oreInfo[14].qnty :=       294;
    oreInfo[14].ingotColor := $052D;
    oreInfo[14].ingotType :=  $1BEF;
    ////////////
    oreInfo[15].name :=      'Black Rock ';
    oreInfo[15].qnty :=       245;
    oreInfo[15].ingotColor := $0455;
    oreInfo[15].ingotType :=  $1BEF;
    ////////////
    oreInfo[16].name :=      'Obsidian   ';
    oreInfo[16].qnty :=       184;
    oreInfo[16].ingotColor := $0028;
    oreInfo[16].ingotType :=  $1BEF;
    ////////////
    oreInfo[17].name :=      'Plutonium  ';
    oreInfo[17].qnty :=       0;
    oreInfo[17].ingotColor := $08AF;
    oreInfo[17].ingotType :=  $1BEF;
    ////////////
    oreInfo[18].name :=      'Dragon     ';
    oreInfo[18].qnty :=       0;
    oreInfo[18].ingotColor := $0085;
    oreInfo[18].ingotType :=  $1BEF;
    ////////////
    oreInfo[19].name :=      'Crystaline ';
    oreInfo[19].qnty :=       0;
    oreInfo[19].ingotColor := $09A4;
    oreInfo[19].ingotType :=  $1BEF;
    ////////////
    oreInfo[20].name :=      'Krynite    ';
    oreInfo[20].qnty :=       0;
    oreInfo[20].ingotColor := $010F;
    oreInfo[20].ingotType :=  $1BEF;
    ////////////
    oreInfo[21].name :=      'Vulcan     ';
    oreInfo[21].qnty :=       0;
    oreInfo[21].ingotColor := $09DA;
    oreInfo[21].ingotType :=  $1BEF;
    ////////////
    oreInfo[22].name :=      'Sand Rock  ';
    oreInfo[22].qnty :=       0;
    oreInfo[22].ingotColor := $008F;
    oreInfo[22].ingotType :=  $1BEF;
    ////////////
    oreInfo[23].name :=      'Blood Crest';
    oreInfo[23].qnty :=       0;
    oreInfo[23].ingotColor := $09EC;
    oreInfo[23].ingotType :=  $1BEF;
    ////////////
    oreInfo[24].name :=      'Steel      ';
    oreInfo[24].qnty :=       0;
    oreInfo[24].ingotColor := $09D3;
    oreInfo[24].ingotType :=  $1BEF;
    ////////////
    oreInfo[25].name :=      'Elvin      ';
    oreInfo[25].qnty :=       0;
    oreInfo[25].ingotColor := $09E6;
    oreInfo[25].ingotType :=  $1BEF;
    ////////////
    oreInfo[26].name :=      'Gorgan     ';
    oreInfo[26].qnty :=       0;
    oreInfo[26].ingotColor := $09F0;
    oreInfo[26].ingotType :=  $1BEF;
    ////////////
    oreInfo[27].name :=      'Acid       ';
    oreInfo[27].qnty :=       0;
    oreInfo[27].ingotColor := $09B9;
    oreInfo[27].ingotType :=  $1BEF;
    ////////////
    oreInfo[28].name :=      'Aqua       ';
    oreInfo[28].qnty :=       0;
    oreInfo[28].ingotColor := $0060;
    oreInfo[28].ingotType :=  $1BEF;
    ////////////
    oreInfo[29].name :=      'Eldar      ';
    oreInfo[29].qnty :=       0;
    oreInfo[29].ingotColor := $0BA7;
    oreInfo[29].ingotType :=  $1BEF;
  end;
  end;
begin 
  initingots; 
  ClearJournal;
  checksave;
  //Продажа ингов.
  addtosystemjournal('Продаем инги');
  SetAutoSellDelay(7);
  for i := 0 to high(oreInfo) do
    AutoSell(oreInfo[i].ingotType, oreInfo[i].ingotColor, oreInfo[i].qnty); 
    repeat
      begin 
        k:=0; 
        cnt_gold := Gold
        checksave;
        UOSay(GetName($004E0C6F)+' sell');
          repeat
            wait(1000);
            k := k + 1;
          until (cnt_gold <> Gold) or (k > 30);
        UOSay('Guards'); 
        wait(5000)
      end;
    until (InJournal('Thou doth posses|You have nothing')<>-1);  
  addtosystemjournal('Успешно!');
end.
