Mining

Копаем руду в шахте
Program Mining;
{$Include 'all.inc'}

type LumbRecord = Record x, y, tt, i: integer; end;

var
k, x, y, i : Integer;
mn1, mf1, mf2, ms1, ms2 : Integer;
ctime, n : TDateTime;

const
//Объекты//

//Типы//
Pickaxe1 = $0E85;
Pickaxe2 = $0E86;
Shovel = $0F39;

//Настройки//
UseShovel = 1;      //1 - используем лопаты //0 - используем кирки
UseLore = 0;        //1 - качать армслор //0 - не качать

procedure ArmsLore;
var
d, t: TDateTime;

begin
  d:=StrToTime('0:00:11');
  if ((now - n) > d) or (n = 0) then
  begin
    t:=now;
    FindType($0F51,backpack);
    if FindCount > 0 then
    begin
      WaitTargetType($0F51)
    end;
    FindType($0F43,backpack);
    if FindCount > 0 then
    begin
      WaitTargetType($0F43)
    end;
    UseSkill('Arms Lore');
    WaitJournalLineSystem(t, 'This|tell', 3000);
    if TargetPresent then CancelTarget;
    n:=now;
  end;
end;

function CheckPickaxe : Boolean;
var tmpser : Cardinal;

begin
  Result := true;
  if (ObjAtLayerEx(RhandLayer, self) = 0) then
  begin
    tmpser := findtype(Pickaxe1, backpack);
    if tmpser = 0 then tmpser := findtype(Pickaxe2, backpack);
    if tmpser = 0 then
    begin
      Result := false;
      exit;
    end;
    if not equip(RhandLayer, tmpser) then
    begin
      wait(1000);
      if not equip(RhandLayer, tmpser) then
      begin
        Result := false;
        exit;
      end;
    end;
    wait(500);
    checksave;
  end;
end;

procedure MiningAround;
var
miningtool : Cardinal;

Begin
  miningtool := ObjAtLayerEx(RhandLayer,self);
  If UseShovel = 1 then
  begin
    miningtool := FindType(Shovel, backpack);
  end;
  for x := -2 to 2 do
  begin
    for y := -2 to 2 do
    begin
      repeat
        waitconnection(5000);
        if UseShovel = 0 then
        begin
          if not CheckPickaxe then
          begin
            exit;
          end;
        end;
        if UseLore = 1 then ArmsLore;
        if TargetPresent then CancelTarget;
        if WarMode = true then SetWarMode(false);
        ctime := Now;
        UseObject(miningtool);
        WaitForTarget(5000);
        If TargetPresent then TargetToTile(1342, GetX(self)+x, GetY(self)+y, GetZ(self));
        k := 0;
        repeat
          wait(100);
          k := k + 1;
          checksave;
          mn1 := InJournalBetweenTimes('stop', ctime, Now);
          mf1 := InJournalBetweenTimes('you can', ctime, Now);
          mf2 := InJournalBetweenTimes('fail', ctime, Now);
          ms1 := InJournalBetweenTimes('way', ctime, Now);
          ms2 := InJournalBetweenTimes('далеко', ctime, Now);
        until (mn1<>-1) or (mf1<>-1) or (mf2<>-1) or (ms1<>-1) or (ms2<>-1) or (k > 300);
      until (mn1<>-1);
    end;
  end;
End;

procedure DropMap;
begin
  repeat
    FindTypeEx($14ED,$ffff,backpack,False);
    if (findcount > 0) then Drop(finditem, 0, 0, 0, 0);;
    Wait(300);
    CheckSave;
  until findcount = 0;
end;

procedure randomstep();
var
ld : Integer;

begin
  ld := Random(4);
  if (ld = 0) then
  begin
    Step(0,false);
    Step(0,false);
  end;
  if (ld = 1) then
  begin
    Step(2,false);
    Step(2,false);
  end;
  if (ld = 2) then
  begin
    Step(4,false);
    Step(4,false);
  end;
  if (ld = 3) then
  begin
    Step(6,false);
    Step(6,false);
  end;
end;

procedure checkresources;
var
stakes, iron, copper, blackdwarf, pagan, silver, spectral, lavarock, icerock, mythril, basilisk, sun, daedra, doom, zulu, paradise, hell, void : Integer;

begin
  stakes := GetQuantity(FindTypeEx($097B, $FFFF, backpack, False));
  iron := GetQuantity(FindTypeEx($19B9, $0000, backpack, False)); //if iron > 9999 then DropHere(FindItem);
  copper := GetQuantity(FindTypeEx($19B9, $0602, backpack, False)); //if copper > 9999 then DropHere(FindItem);
  blackdwarf := GetQuantity(FindTypeEx($19B9, $0425, backpack, False)); //if blackdwarf > 9999 then DropHere(FindItem);
  pagan := GetQuantity(FindTypeEx($19B9, $050C, backpack, False)); //if pagan > 9999 then DropHere(FindItem);
  silver := GetQuantity(FindTypeEx($19B9, $03E9, backpack, False)); 
  spectral := GetQuantity(FindTypeEx($19B9, $0483, backpack, False));
  lavarock := GetQuantity(FindTypeEx($19B9, $0486, backpack, False));
  icerock := GetQuantity(FindTypeEx($19B9, $04E7, backpack, False));
  mythril := GetQuantity(FindTypeEx($19B9, $0492, backpack, False));
  basilisk := GetQuantity(FindTypeEx($19B9, $0487, backpack, False));
  sun := GetQuantity(FindTypeEx($19B9, $0514, backpack, False));
  daedra := GetQuantity(FindTypeEx($19B9, $0494, backpack, False));
  doom := GetQuantity(FindTypeEx($19B9, $049F, backpack, False));
  zulu := GetQuantity(FindTypeEx($19B9, $0488, backpack, False));
  paradise := GetQuantity(FindTypeEx($0F2D,$06FE, backpack, False));
  hell := GetQuantity(FindTypeEx($0F2D,$0ADC, backpack, False));
  AddToSystemJournal('Рыбы: ' + IntToStr(stakes));
  AddToSystemJournal('Iron: ' + IntToStr(iron) + '; Copper: ' + IntToStr(copper) + '; Black Dwarf: ' + IntToStr(blackdwarf) + '; Pagan: ' + IntToStr(pagan) + '; Silver: ' + IntToStr(silver)
  + '; Spectral: ' + IntToStr(spectral) + '; Lavarock: ' + IntToStr(lavarock) + '; Icerock: ' + IntToStr(icerock) + '; Mythril: ' + IntToStr(mythril) + '; Basilisk: ' + IntToStr(basilisk)
  + '; Sun: ' + IntToStr(sun) + '; Daedra: ' + IntToStr(daedra) + '; Doom: ' + IntToStr(Doom) + '; Zulu: ' + IntToStr(zulu) + '; Paradise: ' + IntToStr(paradise) + '; Hell: ' + IntToStr(hell));
end;

Begin
  SetARStatus(true);
  while (connected) do
  begin
    while (true) do
    begin
      for i:=0 to 15 do
      begin
        randomstep;
        FindDistance := 2;
        MiningAround;
        wait(3000);
      end;
      i := i + 1;
      DropMap;
      Hungry(1,backpack);
      CheckResources;
    end;
  end;
End.
Копаем песок в Брите

Указываем Sunduk ID (пакет в банке или сам банк). Кладём в этот сундук рыбу, лопаты.
MaxSand - указываем сколько песка несём в банк.
Если убили - реснётся и пойдёт за новой лопатой.
InitMiningTilesFirst - тут указаны точки где копаем. 5 точек достаточно для безостановочного копания. Копает по направлению East(Восток) 3 точки под собой.

Program Mining;
{$Include 'all.inc'}

type
Tile = Record
x, y : Integer;
end;

var
ctime : TDateTime;
i, k, t : Integer;
MiningTiles : array[0..4] of Tile;

const
xTileBank = 1516; //коорды откуда зовётся банк
yTileBank = 1571; //коорды откуда зовётся банк
Shovel = $0F39;
sand = $0EED; sandcolor = $083B;
MaxSand = 500; //сколько накопать чтобы отнести в банк
Sunduk = $00000000; //ID банка\сумки в банке

procedure InitMiningTilesFirst;
begin

  MiningTiles[0].x := 1521;
  MiningTiles[0].y := 1584;

  MiningTiles[1].x := 1518;
  MiningTiles[1].y := 1591;

  MiningTiles[2].x := 1518;
  MiningTiles[2].y := 1594;

  MiningTiles[3].x := 1518;
  MiningTiles[3].y := 1598;

  MiningTiles[4].x := 1518;
  MiningTiles[4].y := 1602;

end;

procedure Discharge;
var
tmpcnt: integer;
tmpid, tmpstack, tShovel : Cardinal;

begin
  WaitConnection(3000);
  NewMoveXY(xTileBank, yTileBank, true, 0, true);
  UOSay('banka');
  wait(1000);
  checksave;
  if not Dead then
  begin
    tmpcnt := 0;
    repeat
      tmpid := FindTypeEx(sand, sandcolor, backpack, false);
      if tmpid = 0 then break;
      tmpcnt := tmpcnt + 1;
      tmpstack := FindTypeEx(sand, sandcolor, Sunduk, false);
      if tmpstack = 0 then tmpstack := Sunduk;
      MoveItem(tmpid, GetQuantity(tmpid), tmpstack, 0, 0, 0);
      wait(1000);
      CheckSave;
    until tmpid = 0;
    Wait(200);
    IgnoreReset;
    Hungry(1, Sunduk);
    if findtype(shovel,backpack) < 1 then
    begin
      tShovel := FindType(Shovel, Sunduk);
      if FindItem > 0 then
      begin
        MoveItem(tShovel, 1, backpack, 0, 0, 0);
      end;
    end;
  end;
  AddToSystemJournal('Shovels: ' + IntToStr(FindCount) + '. Sand: ' + IntToStr(GetQuantity(FindTypeEx(sand, sandcolor, Sunduk, false))));
end;

procedure CheckMaxSand;
begin
  if GetQuantity(FindTypeEx(sand, sandcolor, backpack, false)) > MaxSand then
  begin
    Discharge;
  end;
end;

procedure BritainCheckDead;
begin
  if Dead then
  begin
    UoSay('.rescue');
    Wait(500);
    Discharge;
  end;
end;

procedure CheckShovels;
begin
  FindType(Shovel, backpack);
  if FindCount = 0 then
  begin
    Discharge;
  end;
end;

procedure DropMap;
begin
  repeat
    FindTypeEx($14ED,$ffff,backpack,False);
    if (findcount > 0) then Drop(finditem, 0, 0, 0, 0);;
    wait(100);
    checksave;
  until findcount = 0;
end;

procedure MineSand;
Begin
  waitconnection(5000);
  if TargetPresent then CancelTarget;
  if WarMode = true then SetWarMode(false);
  ctime := Now;
  for k:=0 to 4 do
  for t:=-1 to 1 do
  begin
    UseObject(FindType(Shovel, backpack));
    WaitForTarget(5000);
    If TargetPresent then TargetToTile(0, GetX(self)+1, GetY(self)+t, 0);
    WaitJournalLine(ctime, 'stop|mine or dig|fail|way|далеко', 30000);
  end;
  t := t + 1;
  k := k + 1;
end;

Begin
  SetARStatus(true);
  InitMiningTilesFirst;
  while (connected) do
  begin
    while (true) do
    begin
      CheckShovels;
      for i:=0 to 4 do
      begin
        NewMoveXY(MiningTiles[i].x, MiningTiles[i].y, false, 1, false);
        MineSand;
        CheckMaxSand;
        Wait(1000);
        BritainCheckDead;
        checksave;
        DropMap;
      end;
      i := i + 1;
    end;
  end;
End.
 
faq/stealth/mining.txt · Последние изменения: 2020/01/23 14:38 — tsatsur
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki