PageRenderTime 119ms CodeModel.GetById 104ms app.highlight 2ms RepoModel.GetById 10ms app.codeStats 0ms

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