Advertisement
kolton

Untitled

Jan 21st, 2015
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. // Blank starter used for testin
  2.  
  3. function ScriptMsgEvent(msg) {
  4. switch (msg) {
  5. case "mule":
  6. AutoMule.check = true;
  7.  
  8. break;
  9. case "muleTorch":
  10. AutoMule.torchCheck = true;
  11.  
  12. break;
  13. case "torch":
  14. TorchSystem.check = true;
  15.  
  16. break;
  17. case "crafting":
  18. CraftingSystem.check = true;
  19.  
  20. break;
  21. case "getMuleMode":
  22. if (AutoMule.torchCheck) {
  23. scriptBroadcast("1");
  24. } else if (AutoMule.check) {
  25. scriptBroadcast("0");
  26. }
  27.  
  28. break;
  29. case "organsystem":
  30. if (!AutoMule.torchCheck) {
  31. OrganSystem.check = true;
  32. }
  33.  
  34. break;
  35. case "pingquit":
  36. pingQuit = true;
  37.  
  38. break;
  39. case "orgCheck":
  40. if (OrganSystem.check) {
  41. scriptBroadcast("1");
  42. } else {
  43. scriptBroadcast("0");
  44. }
  45.  
  46. break;
  47. }
  48. }
  49.  
  50.  
  51.  
  52.  
  53. function main() {
  54. include("json2.js");
  55. include("OOG.js");
  56. include("organsystem.js");
  57. include("common/misc.js");
  58.  
  59. addEventListener('scriptmsg', ScriptMsgEvent);
  60.  
  61. var handle, c,
  62. isUp = "no";
  63.  
  64. this.copyDataEvent = function (mode, msg) {
  65. var obj;
  66.  
  67. switch (msg) {
  68. case "Handle":
  69. handle = mode;
  70.  
  71. break;
  72. }
  73.  
  74. switch (mode) {
  75. case 3: // request game
  76. obj = JSON.parse(msg);
  77.  
  78. if (me.gameReady) {
  79. D2Bot.joinMe(obj.profile, me.gamename.toLowerCase(), "", me.gamepassword.toLowerCase(), isUp);
  80. }
  81. case 4:
  82. // Heartbeat ping
  83. if (msg === "pingreq") {
  84. sendCopyData(null, me.windowtitle, 4, "pingrep");
  85. }
  86.  
  87. break;
  88. }
  89. };
  90.  
  91. this.keyDownEvent = function (key) {
  92. if (key === 45) {
  93. c = true;
  94. }
  95. };
  96.  
  97. this.test = function () {
  98. if (me.ingame) {
  99. return;
  100. }
  101.  
  102. var n, text, i, j, c, x,
  103. search = "cancel";
  104.  
  105. for (n = 1; n <= 12; n += 1) {
  106. for (i = 0; i < 801; i += 1) {
  107. for (j = 0; j < 601; j += 1) {
  108. c = getControl(n, i, j);
  109.  
  110. if (c) {
  111. if (c.text && c.text.toLowerCase().match(search, "gi")) {
  112. print(c.type + " " + c.x + " " + c.y + " " + c.xsize + " " + c.ysize);
  113. }
  114.  
  115. text = c.getText();
  116.  
  117. if (text) {
  118. for (x in text) {
  119. try {
  120. if (text[x].toLowerCase().match(search, "gi")) {
  121. print(text);
  122. print(c.type + " " + c.x + " " + c.y + " " + c.xsize + " " + c.ysize);
  123. }
  124. } catch (e) {
  125. print("Error on: " + text[x]);
  126. }
  127. }
  128. }
  129. }
  130. }
  131. }
  132. }
  133.  
  134. print("done");
  135. };
  136.  
  137. addEventListener("keydown", this.keyDownEvent);
  138. addEventListener('copydata', this.copyDataEvent);
  139.  
  140. var t = getTickCount();
  141.  
  142. while (!handle) {
  143. delay(100);
  144. }
  145.  
  146. DataFile.updateStats("handle", handle);
  147. delay(500);
  148. D2Bot.init();
  149. load("tools/heartbeat.js");
  150.  
  151. if (!FileTools.exists("data/" + me.profile + ".json")) {
  152. DataFile.create();
  153. }
  154.  
  155. if (me.profile === "Mule") {
  156. OrganSystem.waitForMaster();
  157. }
  158.  
  159. print(getTickCount() - t);
  160.  
  161. while (true) {
  162. if (c) {
  163. this.test();
  164.  
  165. c = false;
  166. }
  167.  
  168. if (me.ingame) {
  169. isUp = "yes";
  170. } else {
  171. isUp = "no";
  172. }
  173.  
  174. /*if (me.ingame && me.gameReady && !getScript("default.dbj")) {
  175. print("QQ QQ");
  176. delay(2000);
  177. //sendClick(392, 500);
  178. confirm();
  179. delay(4000);
  180. }*/
  181.  
  182. delay(1000);
  183. }
  184. }
  185.  
  186. // 390, 500
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement