Results 1 to 1 of 1

Thread: Karambwan buyer

  1. #1
    Join Date
    Feb 2017
    Location
    The Netherlands
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    19 Post(s)

    Default Karambwan buyer

    So I tried putting up a karambwan buyer.
    Unfortunately is doesn't work one bit.
    I think I seem to have a problem with NPC-interaction.
    Any advice ?

    Code:
    program karambwan;
    {$DEFINE SMART}
    {$DEFINE WALKER}
    {$I AeroLib/AeroLib.simba}
    {$i Reflection/Reflection.Simba}
    
    const
      P_USERNAME = '';
      P_PASSWORD = '';
      P_PIN = '';
    
    var
      ReflectPlayer: TReflectLocalPlayer;
      Door: TMSObject;
      RSW: TRSWalker;
      karambwanDTM: integer;
    
    procedure LoadItems;
    begin
      RSW.Init('WorldMap');
      RSW.walkStyle := wsSPS;
      RSW.anyAngle := True;
      RSW.skipClose := 15;
    
      Door.create('Bamboo Door', ['Open', 'Bamboo', 'Door'], [createCol(5081253, 1, 0.01, 0.50)]);
      karambwanDTM := DTMFromString('mrAAAAHic42BgYNjIxMCwAYi3A/FyIF4PxLuAeB8QLwbit0A1P4D4CxB/BeLfUP4nIH4HxC4xJkCSESdmZ8APcOuEYBgAAGHHDi0=');
    end;
    
    procedure declarePlayer();
    begin
      Me.Name := P_USERNAME;
      Me.Pass := P_PASSWORD;
      Me.Pin := P_PIN;
      Me.Nick := '';
      Me.Active := True;
      Me.Member := True;
    end;
    
    procedure customMouse(point: TPoint);
    begin
      Writeln('customMouse');
      case random(0, 6) of
        0..2: BrakeMMouse(point, random(3), random(3), true);
        3..5: BrakeMMouse(point, random(3), random(3), false);
        6: HumanMMouse(point, random(3), random(3));
      end;
    end;
    
    function waitWalk(WaitPerLoop, MaxTime: Integer): Boolean;
    var
      T: Timer;
    begin
      T.start();
      while (T.timeElapsed < MaxTime) do
      begin
        if (not (ReflectPlayer.isMoving)) then
          Exit(True);
        Wait(WaitPerLoop);
      end;
    end;
    
    procedure FreeGlobals;
    begin
      Writeln('FreeGlobals');
      FreeDTM(karambwanDTM);
      RSW.Free;
    end;
    
    procedure walkshop;
    begin
     RSW.WalkPath([Point(2939, 4117), Point(2970, 4129), Point(2965, 4169), Point(2951, 4192), Point(2941, 4220)]);
     WaitWalk(1000, 5000);
    end;
    
    procedure dooropen;
    var
    DoorTPA : TPointArray;
    DoorATPA : T2DPointArray;
    pnt : TPoint;
    
    begin
     if Door.find(pnt) then
     begin
        CustomMouse(pnt);
        FastClick(Mouse_Left);
        Wait(RandomRange(200, 400));
     end;
    end;
    
    procedure shop;
     var
      Tiadeche : TReflectNPC;
      x, y : Integer;
      pnt : TPoint;
    begin
        if Tiadeche.Find('Tiadeche') then
        begin
        CustomMouse(Tiadeche.GetMSPoint);
        Wait(RandomRange(200, 400));
        fastClick(MOUSE_RIGHT);
        if waitOption('Trade', 300) then
        ChooseOption('Trade');
        Wait(RandomRange(200, 400));
        end;
    end;
    
    procedure buy;
    var
    x, y : Integer;
    pnt : TPoint;
    
    begin
        CustomMouse(Point(91, 84));
        Wait(RandomRange(200, 400));
        fastClick(MOUSE_RIGHT);
        if waitOption('Buy 10', 300) then
        ChooseOption('Buy 10');
        Wait(RandomRange(10000, 12000))
    end;
    
    procedure walkbank;
    begin
    RSW.WalkPath([Point(2945, 4205), Point(2960, 4189), Point(2959, 4170), Point(2969, 4126), Point(2954, 4114), Point(2936, 4081)]);
    WaitWalk(1000, 2000);
    end;
    
    procedure bank;
     var
      Rionasta : TReflectNPC;
      x, y : Integer;
      pnt : TPoint;
    
    begin
        CustomMouse(Rionasta.GetMSPoint);
        Wait(RandomRange(200, 400));
        fastClick(MOUSE_RIGHT);
        if waitOption('Send-parcel', 300) then
        ChooseOption('Send-parcel');
        Wait(RandomRange(200, 400));
    end;
    
    procedure deposit;
    var
      x, y : Integer;
      pnt : TPoint;
    
    begin
    if FindDTM(karambwanDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
     begin
     CustomMouse(Point(x, y));
     Wait(RandomRange(200, 400));
        fastClick(MOUSE_RIGHT);
        if waitOption('Pack All', 300) then
        ChooseOption('Pack All');
        Wait(RandomRange(200, 400));
     end;
    end;
    
    procedure main;
    var
    pnt : TPoint;
    
    begin
    toggleRunning(true);
    setAngle(ANGLE_HIGH);
    setCompass(90);
    shop;
    buy;
    buy;
    buy;
    closeinterface;
    dooropen;
    walkbank;
    bank;
    deposit;
    closeinterface;
    walkshop;
    door;
    end;
    
    begin
      InitAL;
      DeclarePlayer;
      if not isLoggedIn then
        LoginPlayer(false);
      Reflect.Setup;
      ReflectPlayer.Create;
      LoadItems;
      Main;
      AddOnTerminate('FreeGlobals');
    end.
    Last edited by nielsie95; 03-20-2017 at 03:13 PM. Reason: removed user info

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •