Advertisement
Guest User

Untitled

a guest
Nov 12th, 2012
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.03 KB | None | 0 0
  1. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-]
  2. [ ________ _________.___ __________ ]
  3. [ \_____ \ / _____/| | \______ \ ]
  4. [ / | \ \_____ \ | | | _/ ]
  5. [ / | \/ \| | | | \ ]
  6. [ \_______ /_______ /|___| /\____|_ / ]
  7. [ \/ \/ \/ \/ revision 1 ]
  8. [=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-]
  9. [ O.S.I. Official SCAR Include - Runecrafter ]
  10. [ ]
  11. [ Author : Wanted ]
  12. [ Description : Automates runecrafting and banking tasks in RS2. ]
  13. [ Website : http://scar-divi.com/ ]
  14. [ Directions : See website for usage instructions. ]
  15. [ ]
  16. [ More scripts can be found at scar-divi.com ]
  17. [=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-}
  18.  
  19. {$DEFINE RS2}
  20. {$DEFINE OSI_Color_Anti_Randoms}
  21. {$DEFINE SMART} // Comment out to disable SMART
  22.  
  23. {$I OSI\OSI.scar}
  24. {$I OSI\RS2\Skill\Runecrafting.scar}
  25. {$I OSI\RS2\Skill\Mining.scar}
  26. {$I OSI\RS2\Skill\Woodcutting.scar}
  27.  
  28. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29. INDEXES
  30. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  31.  
  32. const
  33. Script_Revision = 1;
  34. Player_Loads_To_Do = 0;
  35. Player_Max_Ess = 1;
  36. Player_World = 2;
  37. Player_Initial_XP = 3;
  38. Player_Initial_Lvl = 4;
  39. Player_Charges = 5;
  40. Player_Pouches_Count = 6;
  41. Player_Essence_Count = 7;
  42. Player_Task = 0;
  43. Player_Random_World = 0;
  44. Player_Small_Pouch = 1;
  45. Player_Medium_Pouch = 2;
  46. Player_Large_Pouch = 3;
  47. Player_Giant_Pouch = 4;
  48. Player_Medium_Decayed = 5;
  49. Player_Large_Decayed = 6;
  50. Player_Giant_Decayed = 7;
  51. Player_Pure_Essence = 8;
  52. Player_Inv_Exclude = 0;
  53.  
  54. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  55. GLOBAL VARIABLES
  56. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  57.  
  58. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  59. Numbers
  60. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  61.  
  62. var
  63. TimeStarted: Integer;
  64.  
  65. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  66. Text
  67. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  68.  
  69. var
  70. Abyss_Tool, SystemUsername, SystemPassword: string;
  71.  
  72. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  73. Booleans
  74. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  75.  
  76. var
  77. CurrentlyMemberWorld: Boolean;
  78.  
  79. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  80. Form
  81. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  82.  
  83. var
  84. GroupBoxes: array[0..0] of TGroupBox;
  85. ComboBoxes: array[0..1] of TComboBox;
  86. CheckBoxes: array[0..2] of TCheckBox;
  87. Buttons: array[0..9] of TButton;
  88. NxEdits: array[0..7] of TNxEdit;
  89. Labels: array[0..25] of TLabel;
  90. BackgroundPicture: Integer;
  91. StartScript: Boolean;
  92. Form: TForm;
  93.  
  94. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  95. GUI
  96. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  97.  
  98. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  99. procedure SetPlayerLengths(PlayerNo: Integer);
  100. Contributors: Wanted
  101. Description: Sets all player variable lengths.
  102. Date Created: January 9th, 2012. By Wanted. RS2 Build 695.
  103. Last Modification: January 10th, 2012. By Wanted. RS2 Build 696.
  104. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  105.  
  106. procedure SetPlayerLengths(PlayerNo: Integer);
  107. begin
  108. SetLength(Players[PlayerNo].Booleans, 9);
  109. SetLength(Players[PlayerNo].Strings, 1);
  110. SetLength(Players[PlayerNo].Integers, 8);
  111. SetLength(Players[CurrentPlayer].TIA, 1);
  112. Players[PlayerNo].Booleans[0] := True;
  113. end;
  114.  
  115. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  116. function SettingsFile: string;
  117. Contributors: Wanted
  118. Description: Returns the path of settings file.
  119. Date Created: January 9th, 2012. By Wanted. RS2 Build 695.
  120. Last Modification: January 9th, 2012. By Wanted. RS2 Build 695.
  121. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  122.  
  123. function SettingsFile: string;
  124. begin
  125. Result := ScriptPath + 'Form\Settings';
  126. end;
  127.  
  128. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  129. procedure LoadBackground(Sender: TObject);
  130. Contributors: Wanted
  131. Description: Loads the background image in the GUI.
  132. Date Created: January 9th, 2012. By Wanted. RS2 Build 695.
  133. Last Modification: January 9th, 2012. By Wanted. RS2 Build 695.
  134. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  135.  
  136. procedure LoadBackground(Sender: TObject);
  137. begin
  138. SafeCopyCanvas(GetBitmapCanvas(BackgroundPicture), Form.Canvas, 0, 0, 500, 281, 0, 0, 500, 281);
  139. end;
  140.  
  141. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  142. procedure OnKeyPress(Sender: TObject; var Key: Char);
  143. Contributors: SKy Scripter
  144. Description: Keeps stupid people from typing in the combobox.
  145. Date Created: ??? By SKy Scripter
  146. Last Modification: ???. By SKy Scripter.
  147. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  148.  
  149. procedure OnKeyPress(Sender: TObject; var Key: Char);
  150. begin
  151. Key := Chr(VK_CANCEL);
  152. end;
  153.  
  154. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  155. function IdiotStrToIntDef(S: string; Def: LongInt): LongInt;
  156. Contributors: Wanted
  157. Description: Prevents idiots from causing havoc, trust me I've seen it happen.
  158. Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
  159. Last Modification: January 8th, 2012. By Wanted. RS2 Build 695.
  160. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  161.  
  162. function IdiotStrToIntDef(S: string; Def: LongInt): LongInt;
  163. var
  164. S2: string;
  165. begin
  166. S2 := GetNumbers(S);
  167. if (Length(S2) > 9) then
  168. Result := 2147483647
  169. else
  170. Result := StrToIntDef(S2, Def);
  171. end;
  172.  
  173. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  174. procedure UpdateSettingsFromForm;
  175. Contributors: Wanted
  176. Description: Updates global variable and player settings with current form information.
  177. Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
  178. Last Modification: January 8th, 2012. By Wanted. RS2 Build 695.
  179. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  180.  
  181. procedure UpdateSettingsFromForm;
  182. begin
  183. SystemUsername := NxEdits[0].Text;
  184. SystemPassword := NxEdits[1].Text;
  185. Players[CurrentPlayer].Name := NxEdits[2].Text;
  186. Players[CurrentPlayer].Pass := NxEdits[5].Text;
  187. Players[CurrentPlayer].Pin := NxEdits[4].Text;
  188. Players[CurrentPlayer].LampSkill := ComboBoxes[1].Text;
  189. Players[CurrentPlayer].Strings[0] := ComboBoxes[0].Text;
  190. Players[CurrentPlayer].Integers[0] := IdiotStrToIntDef(NxEdits[3].Text, 25);
  191. Players[CurrentPlayer].Integers[1] := IdiotStrToIntDef(NxEdits[6].Text, 2000);
  192. Players[CurrentPlayer].Integers[2] := IdiotStrToIntDef(NxEdits[7].Text, 26);
  193. Players[CurrentPlayer].Active := CheckBoxes[0].Checked;
  194. Players[CurrentPlayer].Booleans[0] := CheckBoxes[1].Checked;
  195. Players[CurrentPlayer].Member := CheckBoxes[2].Checked;
  196. end;
  197.  
  198. procedure SomethingClicked(Sender: TObject); forward;
  199.  
  200. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  201. procedure UpdateFormFromSettings;
  202. Contributors: Wanted
  203. Description: Updates the form with current global variable and player settings.
  204. Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
  205. Last Modification: April 27th, 2012. By Wanted. RS2 Build 713.
  206. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  207.  
  208. procedure UpdateFormFromSettings;
  209. begin
  210. NxEdits[0].Text := SystemUsername;
  211. if (NxEdits[0].Text = '') then
  212. NxEdits[0].Text := 'System Username';
  213. NxEdits[1].Text := SystemPassword;
  214. if (NxEdits[1].Text = '') then
  215. NxEdits[1].Text := '***************';
  216. NxEdits[2].Text := Players[CurrentPlayer].Name;
  217. if (NxEdits[2].Text = '') then
  218. NxEdits[2].Text := 'New Username';
  219. NxEdits[5].Text := Players[CurrentPlayer].Pass;
  220. if (NxEdits[5].Text = '') then
  221. NxEdits[5].Text := 'New Password';
  222. NxEdits[4].Text := Players[CurrentPlayer].Pin;
  223. if (NxEdits[4].Text = '') then
  224. NxEdits[4].Text := '0000';
  225. ComboBoxes[1].Text := Players[CurrentPlayer].LampSkill;
  226. if (ComboBoxes[1].Text = '') then
  227. ComboBoxes[1].Text := 'Agility';
  228. ComboBoxes[0].Text := Players[CurrentPlayer].Strings[0];
  229. if (ComboBoxes[0].Text = '') then
  230. ComboBoxes[0].Text := 'Air (Abyss)';
  231. NxEdits[3].Text := IntToStr(Players[CurrentPlayer].Integers[0]);
  232. if (NxEdits[3].Text = '0') then
  233. NxEdits[3].Text := '25';
  234. NxEdits[6].Text := IntToStr(Players[CurrentPlayer].Integers[1]);
  235. if (NxEdits[6].Text = '0') then
  236. NxEdits[6].Text := '2000';
  237. NxEdits[7].Text := IntToStr(Players[CurrentPlayer].Integers[2]);
  238. if (NxEdits[7].Text = '0') then
  239. NxEdits[7].Text := '26';
  240. CheckBoxes[0].Checked := Players[CurrentPlayer].Active;
  241. CheckBoxes[1].Checked := Players[CurrentPlayer].Booleans[0];
  242. CheckBoxes[2].Checked := Players[CurrentPlayer].Member;
  243. Labels[12].Caption := 'Players[' + IntToStr(CurrentPlayer) + ']';
  244. Labels[25].Caption := 'Players[' + IntToStr(CurrentPlayer) + ']';
  245. SomethingClicked(CheckBoxes[1]);
  246. SomethingClicked(ComboBoxes[0]);
  247. end;
  248.  
  249. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  250. procedure SomethingClicked(Sender: TObject);
  251. Contributors: Wanted
  252. Description: Actions performed when certain form components are clicked.
  253. Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
  254. Last Modification: April 27th, 2012. By Wanted. RS2 Build 713.
  255. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  256.  
  257. procedure SomethingClicked(Sender: TObject);
  258. var
  259. TempP: TRS2Player;
  260. V: TVariantArray;
  261. I: Integer;
  262. begin
  263. case Sender of
  264. Buttons[0]: begin
  265. for I := 1 to 12 do
  266. begin
  267. Labels[I].Hide;
  268. Labels[I + 13].Hide;
  269. end;
  270. for I := 2 to 7 do
  271. NxEdits[I].Hide;
  272. for I := 0 to 1 do
  273. ComboBoxes[I].Hide;
  274. for I := 6 to 9 do
  275. Buttons[I].Hide;
  276. for I := 0 to 2 do
  277. CheckBoxes[I].Hide;
  278. GroupBoxes[0].Show;
  279. Labels[0].Show;
  280. Labels[13].Show;
  281. Buttons[5].Show;
  282. for I := 0 to 1 do
  283. NxEdits[I].Show;
  284. Buttons[0].Enabled := False;
  285. for I := 1 to 4 do
  286. Buttons[I].Enabled := True;
  287. end;
  288. Buttons[1]: begin
  289. GroupBoxes[0].Hide;
  290. Labels[0].Hide;
  291. Labels[13].Hide;
  292. Buttons[5].Hide;
  293. for I := 0 to 1 do
  294. NxEdits[I].Hide;
  295. for I := 2 to 7 do
  296. NxEdits[I].Show;
  297. for I := 0 to 1 do
  298. ComboBoxes[I].Show;
  299. for I := 1 to 12 do
  300. begin
  301. Labels[I].Show;
  302. Labels[I + 13].Show;
  303. end;
  304. for I := 6 to 9 do
  305. Buttons[I].Show;
  306. for I := 0 to 2 do
  307. CheckBoxes[I].Show;
  308. Buttons[1].Enabled := False;
  309. for I := 0 to 4 do
  310. if (I <> 1) then
  311. Buttons[I].Enabled := True;
  312. end;
  313. Buttons[2]: begin
  314. for I := 0 to 7 do
  315. NxEdits[I].Hide;
  316. GroupBoxes[0].Hide;
  317. for I := 0 to 12 do
  318. begin
  319. Labels[I].Hide;
  320. Labels[I + 13].Hide;
  321. end;
  322. for I := 0 to 1 do
  323. ComboBoxes[I].Hide;
  324. for I := 5 to 9 do
  325. Buttons[I].Hide;
  326. for I := 0 to 2 do
  327. CheckBoxes[I].Hide;
  328. Buttons[2].Enabled := False;
  329. for I := 0 to 4 do
  330. if (I <> 2) then
  331. Buttons[I].Enabled := True;
  332. end;
  333. Buttons[3]: begin
  334. for I := 0 to 7 do
  335. NxEdits[I].Hide;
  336. GroupBoxes[0].Hide;
  337. for I := 0 to 12 do
  338. begin
  339. Labels[I].Hide;
  340. Labels[I + 13].Hide;
  341. end;
  342. for I := 0 to 1 do
  343. ComboBoxes[I].Hide;
  344. for I := 5 to 9 do
  345. Buttons[I].Hide;
  346. for I := 0 to 2 do
  347. CheckBoxes[I].Hide;
  348. Buttons[3].Enabled := False;
  349. for I := 0 to 4 do
  350. if (I <> 3) then
  351. Buttons[I].Enabled := True;
  352. end;
  353. Buttons[4]: begin
  354. for I := 0 to 7 do
  355. NxEdits[I].Hide;
  356. GroupBoxes[0].Hide;
  357. for I := 0 to 1 do
  358. ComboBoxes[I].Hide;
  359. for I := 0 to 12 do
  360. begin
  361. Labels[I].Hide;
  362. Labels[I + 13].Hide;
  363. end;
  364. for I := 5 to 9 do
  365. Buttons[I].Hide;
  366. for I := 0 to 2 do
  367. CheckBoxes[I].Hide;
  368. Buttons[4].Enabled := False;
  369. for I := 0 to 3 do
  370. Buttons[I].Enabled := True;
  371. end;
  372. Buttons[5]: begin
  373. SetArrayLength(V, 0);
  374. Form.ModalResult := MROK;
  375. StartScript := True;
  376. end;
  377. Buttons[6]: begin
  378. if (Length(Players) < 2) then
  379. Exit;
  380. UpdateSettingsFromForm;
  381. if (CurrentPlayer = 0) then
  382. CurrentPlayer := High(Players)
  383. else
  384. Dec(CurrentPlayer);
  385. UpdateFormFromSettings;
  386. end;
  387. Buttons[7]: begin
  388. UpdateSettingsFromForm;
  389. SetLength(Players, Length(Players) + 1);
  390. CurrentPlayer := High(Players);
  391. SetPlayerLengths(CurrentPlayer);
  392. UpdateFormFromSettings;
  393. end;
  394. Buttons[8]: begin
  395. if (Length(Players) < 2) then
  396. begin
  397. Players[0] := TempP;
  398. SetPlayerLengths(0);
  399. end
  400. else
  401. SetLength(Players, Length(Players) - 1);
  402. CurrentPlayer := High(Players);
  403. UpdateFormFromSettings;
  404. end;
  405. Buttons[9]: begin
  406. UpdateSettingsFromForm;
  407. if (CurrentPlayer = High(Players)) then
  408. CurrentPlayer := 0
  409. else
  410. Inc(CurrentPlayer);
  411. UpdateFormFromSettings;
  412. end;
  413. CheckBoxes[1]: NxEdits[7].Enabled := (not (CheckBoxes[1].Checked));
  414. ComboBoxes[0]: begin
  415. CheckBoxes[2].Checked := StrInStr('Abyss', ComboBoxes[0].Text);
  416. CheckBoxes[2].Enabled := (not (CheckBoxes[2].Checked));
  417. Labels[11].Enabled := CheckBoxes[2].Enabled;
  418. Labels[24].Enabled := Labels[11].Enabled;
  419. end;
  420. end;
  421. end;
  422.  
  423. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  424. procedure LoadSettings;
  425. Contributors: Wanted
  426. Description: Loads all global variable and player settings from an .ini file.
  427. Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
  428. Last Modification: January 8th, 2012. By Wanted. RS2 Build 695.
  429. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  430.  
  431. procedure LoadSettings;
  432. var
  433. TIA: TIntegerArray;
  434. I, II, H: Integer;
  435. begin
  436. SystemUsername := ReadINI('Access', 'Username', SettingsFile);
  437. SystemPassword := ReadINI('Access', 'Password', SettingsFile);
  438. SetLength(Players, StrToIntDef(ReadINI('Players', 'Length', SettingsFile), 1));
  439. CurrentPlayer := StrToIntDef(ReadINI('Players', 'CurrentPlayer', SettingsFile), 0);
  440. H := High(Players);
  441. for I := 0 to H do
  442. begin
  443. SetPlayerLengths(I);
  444. Players[I].Name := ReadINI('Players' + IntToStr(I), 'Name', SettingsFile);
  445. Players[I].Pass := ReadINI('Players' + IntToStr(I), 'Pass', SettingsFile);
  446. Players[I].Pin := ReadINI('Players' + IntToStr(I), 'Pin', SettingsFile);
  447. Players[I].LampSkill := ReadINI('Players' + IntToStr(I), 'LampSkill', SettingsFile);
  448. Players[I].Active := StrToBoolDef(ReadINI('Players' + IntToStr(I), 'Active', SettingsFile), False);
  449. Players[I].Member := StrToBoolDef(ReadINI('Players' + IntToStr(I), 'Member', SettingsFile), False);
  450. Players[I].Booleans[0] := StrToBoolDef(ReadINI('Players' + IntToStr(I), 'Booleans0', SettingsFile), True);
  451. Players[I].Strings[0] := ReadINI('Players' + IntToStr(I), 'Strings0', SettingsFile);
  452. TIA := [25, 2000, 26];
  453. for II := 0 to 2 do
  454. Players[I].Integers[II] := IdiotStrToIntDef(ReadINI('Players' + IntToStr(I), 'Integers' + IntToStr(II), SettingsFile), TIA[II]);
  455. end;
  456. end;
  457.  
  458. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  459. procedure SaveSettings;
  460. Contributors: Wanted
  461. Description: Saves all global variable and player settings into an .ini file.
  462. Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
  463. Last Modification: January 8th, 2012. By Wanted. RS2 Build 695.
  464. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  465.  
  466. procedure SaveSettings;
  467. var
  468. I, II, H: Integer;
  469. begin
  470. WriteINI('Access', 'Username', SystemUsername, SettingsFile);
  471. WriteINI('Access', 'Password', SystemPassword, SettingsFile);
  472. WriteINI('Players', 'Length', IntToStr(Length(Players)), SettingsFile);
  473. WriteINI('Players', 'CurrentPlayer', IntToStr(CurrentPlayer), SettingsFile);
  474. H := High(Players);
  475. for I := 0 to H do
  476. begin
  477. WriteINI('Players' + IntToStr(I), 'Name', Players[I].Name, SettingsFile);
  478. WriteINI('Players' + IntToStr(I), 'Pass', Players[I].Pass, SettingsFile);
  479. WriteINI('Players' + IntToStr(I), 'Pin', Players[I].Pin, SettingsFile);
  480. WriteINI('Players' + IntToStr(I), 'LampSkill', Players[I].LampSkill, SettingsFile);
  481. WriteINI('Players' + IntToStr(I), 'Active', BoolToStr(Players[I].Active), SettingsFile);
  482. WriteINI('Players' + IntToStr(I), 'Member', BoolToStr(Players[I].Member), SettingsFile);
  483. WriteINI('Players' + IntToStr(I), 'Booleans0', BoolToStr(Players[I].Booleans[0]), SettingsFile);
  484. WriteINI('Players' + IntToStr(I), 'Strings0', Players[I].Strings[0], SettingsFile);
  485. for II := 0 to 2 do
  486. WriteINI('Players' + IntToStr(I), 'Integers' + IntToStr(II), IntToStr(Players[I].Integers[II]), SettingsFile);
  487. end;
  488. end;
  489.  
  490. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  491. procedure FormClosed(Sender: TObject; var CanClose: Boolean);
  492. Contributors: Wanted
  493. Description: Actions performed upon closing form.
  494. Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
  495. Last Modification: January 8th, 2012. By Wanted. RS2 Build 695.
  496. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  497.  
  498. procedure FormClosed(Sender: TObject; var CanClose: Boolean);
  499. begin
  500. UpdateSettingsFromForm;
  501. SaveSettings;
  502. CanClose := True;
  503. end;
  504.  
  505. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  506. procedure InitForm;
  507. Contributors: Wanted
  508. Description: The form initialization super condensed.
  509. Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
  510. Last Modification: April 27th, 2012. By Wanted. RS2 Build 713.
  511. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  512.  
  513. procedure InitForm;
  514. var
  515. FormInfo: TVariantArray;
  516. I, II: Integer; // 0 1 2 3 4 5 6 7 8 9 10 11 12
  517. begin // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
  518. LoadSettings;
  519. BackgroundPicture := LoadBitmap(ScriptPath + 'Form\Background.bmp');
  520. FormInfo := ['Access', 'Players', 'Settings', 'Help', 'About', 'Run', '<<', 'New Player', 'Delete Player', '>>', ' ', 'Authentication', '.Name', 'Task', 'Loads', '.Pin', '.Pass', '.LampSkill', 'Max Ess', 'World', '.Active', 'Random World', '.Member', 41, 35, 49, 27, 43, 33, 56, 20, 260, 29, 232, 57, 244, 45, 256, 33, 8, 55, 59, 'Air (Abyss)', 'Mind (Abyss)', 'Water (Abyss)', 'Earth (Abyss)', 'Fire (Abyss)', 'Body (Abyss)', 'Cosmic (Abyss)', 'Chaos (Abyss)', 'Nature (Abyss)', 'Law (Abyss)', 'Death (Abyss)', 'Blood (Abyss)', 'Agility', 'Attack', 'Constitution', 'Construction', 'Cooking', 'Crafting', 'Defence', 'Dungeoneering ', 'Farming', 'Firemaking', 'Fishing', 'Fletching', 'Herblore', 'Hunting', 'Magic', 'Mining', 'Prayer', 'Ranged', 'Runecrafting', 'Slayer', 'Smithing', 'Strength', 'Summoning', 'Thieving', 'Woodcutting'];
  521. Form := CreateForm;
  522. with Form do
  523. begin
  524. Caption := 'OSI Runecrafter - Revision ' + IntToStr(Script_Revision);
  525. SetBounds(162, 102, 500, 305);
  526. BorderStyle := BSToolWindow;
  527. OnPaint := @LoadBackground;
  528. OnCloseQuery := @FormClosed;
  529. with Font do
  530. begin
  531. Color := clWhite;
  532. Style := [fsBold];
  533. end;
  534. end;
  535. for I := 0 to 9 do
  536. with Buttons[I] do
  537. begin
  538. Buttons[I] := TButton.Create(Form);
  539. Parent := Form;
  540. OnClick := @SomethingClicked;
  541. case I of
  542. 0..4: SetBounds(16 + (96 * I), 253, 85, 19);
  543. 5: SetBounds(166, 204, 170, 38);
  544. 6..9: SetBounds(72 + (90 * (I - 6)), 68, 85, 19);
  545. end;
  546. Caption := FormInfo[I];
  547. //Hint := 'Click to ' + FormInfo[2 * I] + '.';
  548. Font.Style := [];
  549. end;
  550. for I := 0 to 0 do
  551. with GroupBoxes[0] do
  552. begin
  553. GroupBoxes[I] := TGroupBox.Create(Form);
  554. Parent := Form;
  555. //Caption := FormInfo[5 + I];
  556. Caption := ' ';
  557. //SetBounds(FormInfo[2 * I], FormInfo[2 * I], FormInfo[2 * I], FormInfo[1 + (2 * I)]);
  558. SetBounds(66, 96, 370, 90);
  559. Hide;
  560. end;
  561. for I := 0 to 7 do
  562. with NxEdits[I] do
  563. begin
  564. if (I < 2) then
  565. begin
  566. NxEdits[I] := TNxEdit.Create(GroupBoxes[0]);
  567. Parent := GroupBoxes[0];
  568. Enabled := False;
  569. SetBounds(42, 24 + (28 * I), 281, 21);
  570. end
  571. else
  572. begin
  573. NxEdits[I] := TNxEdit.Create(Form);
  574. Parent := Form;
  575. SetBounds(84 + (212 * (I div 5)), 96 + (28 * ((I - 2) mod 3)), 121, 21);
  576. if (Top > 96) then
  577. Top := Top + 28;
  578. end;
  579. BorderStyle := bsNone;
  580. Color := clNone;
  581. if ((I = 4) or (I = 5)) then
  582. PasswordChar := '*';
  583. end;
  584. for I := 0 to 12 do
  585. with Labels[I] do
  586. begin
  587. if (I < 1) then
  588. begin
  589. Labels[I] := TLabel.Create(GroupBoxes[0]);
  590. Labels[I + 13] := TLabel.Create(GroupBoxes[0]);
  591. Parent := GroupBoxes[0];
  592. Labels[I + 13].Parent := GroupBoxes[0];
  593. SetBounds(10, 0, 84, 13);
  594. Labels[I + 13].SetBounds(10, 0, 84, 13);
  595. end
  596. else
  597. begin
  598. Labels[I] := TLabel.Create(Form);
  599. Labels[I + 13] := TLabel.Create(Form);
  600. Parent := Form;
  601. Labels[I + 13].Parent := Form;
  602. case I of
  603. 0, 12: SetBounds(FormInfo[39 + (3 * (I - 12))], FormInfo[40 + (3 * (I - 12))], FormInfo[41 + (3 * (I - 12))], 13);
  604. 1..8: SetBounds(FormInfo[21 + (2 * I)], 100 + (28 * ((I - 1) mod 4)), FormInfo[24 + (2 * (I - 1))], 13);
  605. 9..11: SetBounds(104 + (211 * (I div 10)), 208 + (18 * (I div 11)), 83, 13);
  606. end;
  607. end;
  608. Labels[I + 13].SetBounds(Left - 1, Top - 1, Width, Height);
  609. Caption := FormInfo[11 + I];
  610. Labels[I + 13].Caption := FormInfo[11 + I];
  611. Labels[I].Font.Color := clBlack;
  612. end;
  613. for I := 0 to 1 do
  614. with ComboBoxes[I] do
  615. begin
  616. ComboBoxes[I] := TComboBox.Create(Form);
  617. Parent := Form;
  618. SetBounds(84 + (I * 212), 124, 121, 21);
  619. Color := clNone;
  620. OnKeyPress := @OnKeyPress;
  621. for II := 0 to (11 + (13 * I)) do
  622. Items.Add(FormInfo[42 + (12 * I) + II]);
  623. OnClick := @SomethingClicked;
  624. end;
  625. for I := 0 to 2 do
  626. with CheckBoxes[I] do
  627. begin
  628. CheckBoxes[I] := TCheckBox.Create(Form);
  629. Parent := Form;
  630. SetBounds(84 + (212 * ((I + 9) div 10)), 206 + (20 * ((I + 9) div 11)), 14, 17);
  631. OnClick := @SomethingClicked;
  632. end;
  633. SomethingClicked(Buttons[0]);
  634. UpdateFormFromSettings;
  635. end;
  636.  
  637. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  638. procedure FormSafeInit;
  639. Contributors: Freddy
  640. Description: Safe form display
  641. Date Created: ??? By Freddy
  642. Last Modification: ??? By Freddy
  643. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  644.  
  645. procedure FormSafeInit;
  646. var
  647. v: TVariantArray;
  648. begin
  649. SetLength(v, 0);
  650. ThreadSafeCall('InitForm', v);
  651. end;
  652.  
  653. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  654. function FormShowModal: Boolean;
  655. Contributors: Freddy
  656. Description: Safe form display
  657. Date Created: ??? By Freddy
  658. Last Modification: ??? By Freddy
  659. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  660.  
  661. function FormShowModal: Boolean;
  662. begin
  663. Result := Form.ShowModal = mrOk;
  664. end;
  665.  
  666. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  667. function FormSafeShowModal: Boolean;
  668. Contributors: Freddy
  669. Description: Safe form display
  670. Date Created: ??? By Freddy
  671. Last Modification: ??? By Freddy
  672. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  673.  
  674. function FormSafeShowModal: Boolean;
  675. var
  676. v: TVariantArray;
  677. begin
  678. SetLength(v, 0);
  679. Result := ThreadSafeCall('FormShowModal', v);
  680. end;
  681.  
  682. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  683. SCRIPT
  684. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  685.  
  686. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  687. procedure InitScript;
  688. Contributors: Wanted
  689. Description: Initiates the script.
  690. Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
  691. Last Modification: January 8th, 2012. By Wanted. RS2 Build 695.
  692. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  693.  
  694. procedure InitScript;
  695. begin
  696. ClearDebug;
  697. try
  698. FormSafeInit;
  699. FormSafeShowModal;
  700. except
  701. WriteLn('Error in Form');
  702. finally
  703. FreeForm(Form);
  704. FreeBitmap(BackgroundPicture);
  705. end;
  706. if (not (StartScript)) then
  707. TerminateScript;
  708. SetUpOSI;
  709. {$IFNDEF SMART}
  710. FindWindowBySize(RSPW, RSPH);
  711. WaitRR(500, 750);
  712. ActivateClient;
  713. {$ENDIF}
  714. WaitRR(1000, 2000);
  715. TimeStarted := GetSystemTime;
  716. end;
  717.  
  718. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  719. function PlayerRune(PlayerNo: Integer): string;
  720. Contributors: Wanted
  721. Description: Returns the rune this player will be crafting.
  722. Date Created: January 10th, 2012. By Wanted. RS2 Build 696.
  723. Last Modification: January 10th, 2012. By Wanted. RS2 Build 696.
  724. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  725.  
  726. function PlayerRune(PlayerNo: Integer): string;
  727. begin
  728. Result := Copy(Players[CurrentPlayer].Strings[Player_Task], 1, (Pos('(', Players[CurrentPlayer].Strings[Player_Task]) - 2));
  729. end;
  730.  
  731. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  732. function PlayerRuneLoc(PlayerNo: Integer): string;
  733. Contributors: Wanted
  734. Description: Returns the location that this player will be using to runecraft.
  735. Date Created: January 10th, 2012. By Wanted. RS2 Build 696.
  736. Last Modification: January 10th, 2012. By Wanted. RS2 Build 696.
  737. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  738.  
  739. function PlayerRuneLoc(PlayerNo: Integer): string;
  740. begin
  741. Result := Between('(', ')', Players[CurrentPlayer].Strings[Player_Task]);
  742. end;
  743.  
  744. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  745. function InitPlayer: Boolean;
  746. Contributors: Wanted
  747. Description: Initiates a player, true if log in successful.
  748. Date Created: January 9th, 2012. By Wanted. RS2 Build 695.
  749. Last Modification: May 13th, 2012. By Wanted. RS2 Build 716.
  750. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  751.  
  752. function InitPlayer: Boolean;
  753. var
  754. PNames, PureEssenceRunes: TStringArray;
  755. I, Slot, dtmTool, Tol: Integer;
  756. PAmounts: TIntegerArray;
  757. S: string;
  758. P: TPoint;
  759. B: TBox;
  760. begin
  761. if (not (CurrentlyMemberWorld)) then
  762. begin
  763. if (Players[CurrentPlayer].Booleans[Player_Random_World]) then
  764. Players[CurrentPlayer].WorldInfo := [Players[CurrentPlayer].Member, -1, False]
  765. else
  766. Players[CurrentPlayer].WorldInfo := [Players[CurrentPlayer].Member, Players[CurrentPlayer].Integers[Player_World]];
  767. CurrentlyMemberWorld := True;
  768. end
  769. else
  770. Players[CurrentPlayer].WorldInfo := [];
  771. Result := LoggedIn;
  772. if (not (Result)) then
  773. Result := Login;
  774. if (not (Result)) then
  775. Exit;
  776. PureEssenceRunes := ['Cosmic', 'Chaos', 'Astral', 'Nature', 'Law', 'Armadyl', 'Blood'];
  777. Players[CurrentPlayer].Booleans[Player_Pure_Essence] := InStrArr(PlayerRune(CurrentPlayer), PureEssenceRunes, False);
  778. S := 'regular';
  779. if (Players[CurrentPlayer].Booleans[Player_Pure_Essence]) then
  780. S := 'pure';
  781. WriteLn('Player set to runecraft ' + S + ' essence into ' + LowerCase(PlayerRune(CurrentPlayer)) + ' runes at ' + PlayerRuneLoc(CurrentPlayer) + '.');
  782. WaitRR(500, 750);
  783. SetAngle(True);
  784. MakeCompass(Dir_North);
  785. Wait(1500); //ScanForRandoms(1500, T); // FIX
  786. SetChats([Chat_All_Tab, Chat_Game_Tab, Chat_Public_Tab, Chat_Private_Tab, Chat_Friends_Tab, Chat_Clan_Tab, Chat_Trade_Tab, Chat_Assist_Tab],
  787. [Chat_View, Chat_All, Chat_Hide, Chat_Off, Chat_Off, Chat_Off, Chat_On, Chat_Off]);
  788. GetAllLevels(True);
  789. if (Players[CurrentPlayer].Integers[Player_Initial_XP] = 0) then
  790. Players[CurrentPlayer].Integers[Player_Initial_XP] := GetXP(Skill_Runecrafting, False);
  791. if (Players[CurrentPlayer].Integers[Player_Initial_Lvl] = 0) then
  792. Players[CurrentPlayer].Integers[Player_Initial_Lvl] := Players[CurrentPlayer].Level[Skill_Runecrafting];
  793. WriteLn('RC Level: ' + IntToStr(Players[CurrentPlayer].Level[Skill_RuneCrafting]) + ' Exp: ' + IntToStr(Players[CurrentPlayer].Integers[Player_Initial_XP]));
  794. SetGameTab(Tab_Equip);
  795. B := GetEquipmentBounds(Tab_Equip_Right_Hand);
  796. Abyss_Tool := '';
  797. dtmTool := LoadMiningItem(dtmPickaxe, Tol);
  798. if (FindDTM(dtmTool, P.X, P.Y, B.X1, B.Y1, B.X2, B.Y2)) then
  799. Abyss_Tool := 'Pickaxe';
  800. FreeDTM(dtmTool);
  801. if (Abyss_Tool = '') then
  802. begin
  803. dtmTool := LoadWoodcuttingItem(dtmHatchet, Tol);
  804. if (FindDTM(dtmTool, P.X, P.Y, B.X1, B.Y1, B.X2, B.Y2)) then
  805. Abyss_Tool := 'Hatchet';
  806. FreeDTM(dtmTool);
  807. end;
  808. if (Abyss_Tool <> '') then
  809. WriteLn(Abyss_Tool + ' abyss entrance tool detected.')
  810. else
  811. WriteLn('No abyss entrance tool detected.');
  812. ClickEquipedItem(Tab_Equip_Neck, MoveTo, False);
  813. WaitRR(1000, 1500);
  814. Players[CurrentPlayer].Integers[Player_Charges] := StrToIntDef(GetNumbers(Copy(GetUpText, 1, 25)), 0);
  815. WriteLn('Equipped Amulet of glory(' + IntToStr(Players[CurrentPlayer].Integers[Player_Charges]) + ') detected.');
  816. SetGameTab(Tab_Inv);
  817. PNames := ['Small', 'Medium', 'Large', 'Gaint'];
  818. Players[CurrentPlayer].Integers[Player_Pouches_Count] := 0;
  819. PAmounts := [2, 5, 8, 11];
  820. Players[CurrentPlayer].Integers[Player_Essence_Count] := 28;
  821. for I := 0 to 3 do
  822. if (FindPouch(I, Slot, False)) then
  823. begin
  824. Inc(Players[CurrentPlayer].Integers[Player_Pouches_Count]);
  825. WriteLn(PNames[I] + ' pouch detected in slot ' + IntToStr(Slot) + '.');
  826. Players[CurrentPlayer].Booleans[I + 1] := True;
  827. IncEx(Players[CurrentPlayer].Integers[Player_Essence_Count], PAmounts[I]);
  828. SetLength(Players[CurrentPlayer].TIA[Player_Inv_Exclude], Length(Players[CurrentPlayer].TIA[Player_Inv_Exclude]) + 1);
  829. Players[CurrentPlayer].TIA[Player_Inv_Exclude][High(Players[CurrentPlayer].TIA[Player_Inv_Exclude])] := Slot;
  830. end;
  831. if (Players[CurrentPlayer].Integers[Player_Pouches_Count] < 1) then
  832. WriteLn('No pouches detected.')
  833. else
  834. WriteLn(IntToStr(Players[CurrentPlayer].Integers[Player_Pouches_Count]) + ' pouch(es) detected.');
  835. Players[CurrentPlayer].Loc := 'EVB.';
  836. end;
  837.  
  838. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  839. procedure Banking;
  840. Contributors: Wanted
  841. Description: Everything for banking.
  842. Date Created: January 9th, 2012. By Wanted. RS2 Build 695.
  843. Last Modification: January 10th, 2012. By Wanted. RS2 Build 696.
  844. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  845.  
  846. procedure Banking;
  847. var
  848. I, EBC, dtmGlory_Amulet: Integer;
  849. PAmounts: TIntegerArray;
  850. P: TPoint;
  851. S: string;
  852. B: TBox;
  853. begin
  854. if (Players[CurrentPlayer].Loc <> 'EVB.') then
  855. Exit;
  856. if (not (LoggedIn)) then
  857. Exit;
  858. if (Players[CurrentPlayer].Booleans[Player_Medium_Pouch]) then
  859. if (not (Players[CurrentPlayer].Booleans[Player_Medium_Decayed])) then
  860. if (FindPouch(bmpPouch_Medium_Damaged, I, True)) then
  861. begin
  862. Players[CurrentPlayer].Booleans[Player_Medium_Decayed] := True;
  863. WriteLn('Damaged medium pouch detected.');
  864. DecEx(Players[CurrentPlayer].Integers[Player_Essence_Count], 3);
  865. end;
  866. if (Players[CurrentPlayer].Booleans[Player_Large_Pouch]) then
  867. if (not (Players[CurrentPlayer].Booleans[Player_Large_Decayed])) then
  868. if (FindPouch(bmpPouch_Large_Damaged, I, True)) then
  869. begin
  870. Players[CurrentPlayer].Booleans[Player_Large_Decayed] := True;
  871. WriteLn('Damaged large pouch detected.');
  872. DecEx(Players[CurrentPlayer].Integers[Player_Essence_Count], 3);
  873. end;
  874. if ((InvFull(True)) and (Players[CurrentPlayer].Integers[Player_Charges] > 0)) then
  875. Exit;
  876. Players[CurrentPlayer].Loc := 'Banking...';
  877. WriteLn('Banking...');
  878. if (Players[CurrentPlayer].Integers[Player_Charges] < 1) then
  879. begin
  880. WriteLn('Glory amulet has run out of charges. Switching to new amulet...');
  881. ClickEquipedItem(Tab_Equip_Necklace, ClickLeft, True);
  882. SetGameTab(Tab_Inv);
  883. end;
  884. if (not (OpenBank(Loc_EVB))) then
  885. begin
  886. WriteLn('Unable to Open Bank! Logging out...');
  887. Logout;
  888. Players[CurrentPlayer].Active := False;
  889. Players[CurrentPlayer].Loc := 'Can''t find bank';
  890. Exit;
  891. end;
  892. DepositAllExclude(Players[CurrentPlayer].TIA[Player_Inv_Exclude], False);
  893. if (Players[CurrentPlayer].Integers[Player_Charges] < 1) then
  894. begin
  895. dtmGlory_Amulet := DTMFromString('78DA639CC8C8C0F0930105648BF433480269A' +
  896. '00CC37F2060EC03B2DE32A0012630C908E531F60059AF08A89905' +
  897. '64BD26A0662E116AA60159BF8970CF4F026A407EFF875F0D00BE0' +
  898. 'F1177');
  899. B := GetBankSlotBounds(38);
  900. if (not (FindDTM(dtmGlory_Amulet, P.X, P.Y, B.X1, B.Y1, B.X2, B.Y2))) then
  901. begin
  902. WriteLn('Out of glories! Logging out...');
  903. CloseBank(False);
  904. Logout;
  905. Players[CurrentPlayer].Active := False;
  906. Players[CurrentPlayer].Loc := 'Out of glories';
  907. FreeDTM(dtmGlory_Amulet);
  908. Exit;
  909. end;
  910. FreeDTM(dtmGlory_Amulet);
  911. Withdraw(Withdraw_1, 38, False);
  912. for I := 0 to 27 do
  913. if (not (TIAContains(Players[CurrentPlayer].TIA[Player_Inv_Exclude], I))) then
  914. begin
  915. MouseItem(I, ClickRight, False);
  916. ChooseOptionMulti(['Wea', 'ear', 'ar A']);
  917. Break;
  918. end;
  919. Players[CurrentPlayer].Integers[Player_Charges] := 4;
  920. end;
  921. Withdraw(Withdraw_All, 39, False);
  922. PAmounts := [2, 5, 8, 11];
  923. for I := 0 to 1 do
  924. if (Players[CurrentPlayer].Booleans[I + 5]) then
  925. DecEx(PAmounts[I + 1], 3);
  926. EBC := 28;
  927. for I := 0 to 3 do
  928. if (Players[CurrentPlayer].Booleans[I + 1]) then
  929. begin
  930. IncEx(EBC, PAmounts[I]);
  931. if (EBC > 50) then
  932. Withdraw(Withdraw_All, 39, False);
  933. ClickPouch(I, Pouch_Fill, False);
  934. end;
  935. if (EBC > 28) then
  936. Withdraw(Withdraw_All, 39, False);
  937. S := 'regular';
  938. if (Players[CurrentPlayer].Booleans[Player_Pure_Essence]) then
  939. S := 'pure';
  940. WriteLn(IntToStr(Players[CurrentPlayer].Integers[Player_Essence_Count]) + ' ' + s + ' essences being carried.');
  941. WriteLn('Finished banking.');
  942. Players[CurrentPlayer].Loc := 'EVB.';
  943. end;
  944.  
  945. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  946. function WalkOutOfBank: Boolean;
  947. Contributors: Wanted
  948. Description: Walks out of the bank using banker NPC MM dtm.
  949. Date Created: January 11th, 2012. By Wanted. RS2 Build 696.
  950. Last Modification: January 11th, 2012. By Wanted. RS2 Build 696.
  951. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  952.  
  953. function WalkOutOfBank: Boolean;
  954. var
  955. dtm_Bankers_Exit: Integer;
  956. Angle: Extended;
  957. P: TPoint;
  958. begin
  959. dtm_Bankers_Exit := DTMFromString('78DA635CC6C4C0A0C68002FA972633FC07D28' +
  960. 'C40FC1F08182B816A4221722C5035FFFFB2302843D58000588D2F' +
  961. '0135554035AE04D4D402D538E1570300DC321321');
  962. FindDTMRotated(dtm_Bankers_Exit, P.X, P.Y, MMX1, MMY1, MMX2, MMY2, Radians(-15), Radians(15), Radians(1), Angle);
  963. FreeDTM(dtm_Bankers_Exit);
  964. Result := OnMM(P.X, P.Y);
  965. if (not (Result)) then
  966. Exit;
  967. MouseFlagEx(P.X, P.Y, 0, 0, 10);
  968. end;
  969.  
  970. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  971. ABYSS
  972. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  973.  
  974. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  975. function CrossWildernessWall: Boolean;
  976. Contributors: Wanted
  977. Description: Finds and jumns over the wilderness wall.
  978. Date Created: January 11th, 2012. By Wanted. RS2 Build 696.
  979. Last Modification: January 11th, 2012. By Wanted. RS2 Build 696.
  980. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  981.  
  982. function CrossWildernessWall: Boolean;
  983. var
  984. ATPA: T2DPointArray;
  985. TPA: TPointArray;
  986. I, H: Integer;
  987. P: TPoint;
  988. begin
  989. Result := False;
  990. ColorToleranceSpeed(2);
  991. SetColorSpeed2Modifiers(0.19, 0.98);
  992. FindColorsTolerance(TPA, 3685954, MSX1, MSY1, MSX2, MSY2, 6);
  993. SetColorSpeed2Modifiers(0.2, 0.2);
  994. ColorToleranceSpeed(1);
  995. if (Length(TPA) < 100) then
  996. Exit;
  997. ATPA := TPAToATPAEx(TPA, 50, 50);
  998. H := High(ATPA);
  999. if (H < 0) then
  1000. Exit;
  1001. SortATPAByMiddleEx(ATPA, Point(MSCX, MSCY));
  1002. for I := 0 to H do
  1003. if (Length(ATPA[I]) > 150) then
  1004. begin
  1005. P := MiddleTPA(ATPA[I]);
  1006. MMouse(P.X, P.Y, 0, 0);
  1007. if (not (IsUpTextMulti(['ross', 'ildern', 'erness', ' wall']))) then
  1008. Continue;
  1009. GetMousePos(P.X, P.Y);
  1010. Mouse(P.X, P.Y, 0, 0, True);
  1011. Flag;
  1012. WaitRR(750, 1250);
  1013. if (GetColor(185, 242) = 65536) then
  1014. begin
  1015. if (GetColor(142, 220) = 65536) then
  1016. begin
  1017. MouseBox(139, 224, 148, 232, ClickLeft);
  1018. WaitRR(500, 700);
  1019. end;
  1020. MouseBox(142, 244, 227, 294, ClickLeft);
  1021. Flag;
  1022. WaitRR(1000, 2000);
  1023. end;
  1024. Result := True;
  1025. Exit;
  1026. end;
  1027. WriteLn('Unable to find wilderness wall!');
  1028. end;
  1029.  
  1030. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1031. function WalkAfterWall: Boolean;
  1032. Contributors: Wanted
  1033. Description: Walks after the wall using the tree trunk MM dtm.
  1034. Date Created: January 11th, 2012. By Wanted. RS2 Build 696.
  1035. Last Modification: January 11th, 2012. By Wanted. RS2 Build 696.
  1036. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  1037.  
  1038. function WalkAfterWall: Boolean;
  1039. var
  1040. dtm_Past_Wall: Integer;
  1041. Angle: Extended;
  1042. P: TPoint;
  1043. begin
  1044. dtm_Past_Wall := DTMFromString('78DA636C62626050604001FD4B9319FE03694' +
  1045. '620FE0F048C49403552103916A81AB560210649A81A1060EC2242' +
  1046. '4D1A508D1E0135CD84D50000D7470C4E');
  1047. FindDTMRotated(dtm_Past_Wall, P.X, P.Y, MMX1, MMY1, MMX2, MMY2, Radians(-15), Radians(15), Radians(1), Angle);
  1048. FreeDTM(dtm_Past_Wall);
  1049. Result := OnMM(P.X, P.Y);
  1050. if (not (Result)) then
  1051. Exit;
  1052. MouseFlagEx(P.X, P.Y, 0, 0, 10);
  1053. end;
  1054.  
  1055.  
  1056. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1057. procedure WalkToAbyss;
  1058. Contributors: Wanted
  1059. Description: Walks up to the zamorak mage and teleports into abyss.
  1060. Date Created: January 11th, 2012. By Wanted. RS2 Build 696.
  1061. Last Modification: January 11th, 2012. By Wanted. RS2 Build 696.
  1062. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  1063.  
  1064. procedure WalkToAbyss;
  1065. begin
  1066. //if (Players[CurrentPlayer].Loc <> 'EVB.') then FIX
  1067. //Exit; FIX
  1068. if (not (LoggedIn)) then
  1069. Exit;
  1070. Players[CurrentPlayer].Loc := 'Walking to mage';
  1071. WriteLn('Walking to zamorak mage...');
  1072. if (not (WalkOutOfBank)) then
  1073. MouseFlagEx(661, 37, 2, 3, 10);
  1074. MouseFlag(637, 13, 1, 1);
  1075. WaitRR(500, 700);
  1076. if (not (CrossWildernessWall)) then
  1077. begin
  1078. MouseFlag(MMCX, 57, 1, 7);
  1079. WaitRR(500, 700);
  1080. if (not (CrossWildernessWall)) then
  1081. begin
  1082. WriteLn('Could not cross wilderness wall! logging out...');
  1083. Logout;
  1084. Players[CurrentPlayer].Active := False;
  1085. Players[CurrentPlayer].Loc := 'Can''t find wall';
  1086. Exit;
  1087. end;
  1088. end;
  1089. if (not (WalkAfterWall)) then
  1090. MouseFlagEx(641, 34, 2, 3, 10);
  1091. MouseFlagEx(628, 43, 2, 4, 10);
  1092. end;
  1093.  
  1094. function TeleportZamorakMage: Boolean;
  1095. var
  1096. T, TT, I, H, Atmp: Integer;
  1097. TPA, TPA2: TPointArray;
  1098. ATPA: T2DPointArray;
  1099. P: TPoint;
  1100. B: TBox;
  1101. begin
  1102. Result := False;
  1103. T := GetSystemTime + RR(80000, 100000);
  1104. Atmp := 0;
  1105. repeat
  1106. Inc(Atmp);
  1107. ColorToleranceSpeed(2);
  1108. SetColorSpeed2Modifiers(0.59, 0.32);
  1109. FindMMColorsTolerance(TPA, 8615537, 11);
  1110. SetColorSpeed2Modifiers(0.2, 0.2);
  1111. ColorToleranceSpeed(1);
  1112. if (Length(TPA) < 30) then
  1113. Exit;
  1114. ATPA := SplitTPA(TPA, 5);
  1115. SortATPASize(ATPA, True);
  1116. if (Length(ATPA) < 1) then
  1117. Exit;
  1118. TPA := ATPA[0];
  1119. TPASortEx(TPA, Point(MMX1, MMY1));
  1120. P := TPA[0];
  1121. if (Atmp > 3) then
  1122. Atmp := 1;
  1123. case Atmp of
  1124. 1: MouseFlag(P.X, P.Y - 16, 2, 2);
  1125. 2: MouseFlag(P.X - 10, P.Y - 7, 2, 2);
  1126. 3: MouseFlag(P.X, P.Y - 30, 2, 2);
  1127. end;
  1128. WaitRR(500, 700);
  1129. TT := GetSystemTime + RR(4000, 6000);
  1130. while (GetSystemTime < TT) do
  1131. begin
  1132. ATPA := FindMMDotsExOverlap([cldYellowDot]);
  1133. if (Length(ATPA) < 1) then
  1134. Continue;
  1135. TPA := ATPA[0];
  1136. TPA := MMsToMSs(TPA);
  1137. if (Length(TPA) < 1) then
  1138. Continue;
  1139. H := High(TPA);
  1140. for I := 0 to H do
  1141. begin
  1142. B := Box(TPA[I].X - 30, TPA[I].Y - 30, TPA[I].X + 30, TPA[I].Y + 30);
  1143. ColorToleranceSpeed(2);
  1144. SetColorSpeed2Modifiers(0.17, 0.12);
  1145. FindColorsTolerance(TPA2, 1779289, B.X1, B.Y1, B.X2, B.Y2, 13);
  1146. SetColorSpeed2Modifiers(0.2, 0.2);
  1147. ColorToleranceSpeed(1);
  1148. if (Length(TPA2) > 50) then
  1149. begin
  1150. ATPA := SplitTPA(TPA2, 4);
  1151. SortATPASize(ATPA, True);
  1152. if (Length(ATPA) < 1) then
  1153. Continue;
  1154. P := MiddleTPA(ATPA[0]);
  1155. MMouse(P.X, P.Y, 0, 0);
  1156. if (not (IsUpTextMulti(['alk-to', 'Mage', ' Zam', 'amora', 'morak']))) then
  1157. Continue;
  1158. GetMousePos(P.X, P.Y);
  1159. Mouse(P.X, P.Y, 0, 0, False);
  1160. if (not (ChooseOptionMulti(['rade']))) then // FIX
  1161. Continue;
  1162. Break;
  1163. end;
  1164. end;
  1165. if (I <= H) then
  1166. begin
  1167. //InAbyssLoop Result True Exit
  1168. end;
  1169. end;
  1170. WriteLn('Zamorak Mage not found! Repositioning...');
  1171. until (GetSystemTime > T)
  1172. end;
  1173.  
  1174. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1175. MAIN LOOP
  1176. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  1177.  
  1178. {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1179. procedure MainLoop;
  1180. Contributors: Wanted
  1181. Description: The entire repeating portion of script pulled
  1182. together here to avoid use of extra global vars.
  1183. Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
  1184. Last Modification: January 11th, 2012. By Wanted. RS2 Build 697.
  1185. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
  1186.  
  1187. procedure MainLoop;
  1188. begin
  1189. InitPlayer; //FIX
  1190. Banking; //FIX
  1191. WalkToAbyss; //FIX
  1192. TeleportZamorakMage; // FIX
  1193. end;
  1194.  
  1195. begin
  1196. InitScript;
  1197. MainLoop;
  1198. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement