/lib/antirandoms/RandomFunctions.simba

http://github.com/Drags111/Reflection_Dev · Unknown · 51 lines · 42 code · 9 blank · 0 comment · 0 complexity · 4d5844ca28b30439569cb1b97c5c458f MD5 · raw file

  1. (*
  2. RRandom_TalkToNPC
  3. ~~~~~~~~~~~~
  4. .. code-block:: pascal
  5. function RRandom_TalkToNPC(NPC: TNPC; UseMinimap: Boolean): Boolean;
  6. Handles interacting with an NPC. Returns if ended up in chat. Used in Antirandoms.
  7. .. note::
  8. by mormonman
  9. *)
  10. function RRandom_TalkToNPC(NPC: TNPC; UseMM: Boolean; RName: String): Boolean;
  11. var
  12. T: Integer;
  13. WalkProc: function(T: TTile): Boolean;
  14. P: TPoint;
  15. begin
  16. Result := ClickContinue(False, False);
  17. if Result then
  18. Exit;
  19. if not R_TileOnMS(NPC.Tile, NPC.Height * (3/4)) then
  20. begin
  21. if UseMM then WalkProc := @R_WindWalk
  22. else WalkProc := @R_WindWalkMS;
  23. if not WalkProc(NPC.Tile)then
  24. begin
  25. R_Debug('Unable to walk to NPC', RName);
  26. Exit;
  27. end;
  28. Wait(300+Random(50));
  29. end;
  30. P := R_TileToMS(NPC.Tile, NPC.Height * (3/4));
  31. MMouse(P.x, P.y, 3, 3);
  32. wait(25+Random(25));
  33. if not R_OptionExists('talk')then
  34. Exit;
  35. GetMousePos(P.x, P.y);
  36. Mouse(P.x, P.y, 0, 0, False);
  37. if not R_ChooseOption('talk')then
  38. Exit;
  39. MarkTime(T);
  40. while (TimeFromMark(T) < 8000) and (not Result) do
  41. Result := ClickContinue(False, False);
  42. end;