daily pastebin goal
54%
SHARE
TWEET

Untitled

a guest Dec 8th, 2015 310 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --horikawaTools.lua
  2. --v1.0.0
  3. --Created by Horikawa Otane, 2015
  4.  
  5. local horikawaTools = {}
  6.  
  7. horikawaTools.npcList = {}
  8.  
  9. horikawaTools.npcList[1] = true
  10. horikawaTools.npcList[2] = true
  11. horikawaTools.npcList[3] = true
  12. horikawaTools.npcList[4] = true
  13. horikawaTools.npcList[5] = true
  14. horikawaTools.npcList[6] = true
  15. horikawaTools.npcList[7] = true
  16. horikawaTools.npcList[8] = true
  17. horikawaTools.npcList[9] = false
  18. horikawaTools.npcList[10] = false
  19. horikawaTools.npcList[11] = false
  20. horikawaTools.npcList[12] = true
  21. horikawaTools.npcList[13] = false
  22. horikawaTools.npcList[14] = false
  23. horikawaTools.npcList[15] = 2
  24. horikawaTools.npcList[16] = false
  25. horikawaTools.npcList[17] = true
  26. horikawaTools.npcList[18] = true
  27. horikawaTools.npcList[19] = true
  28. horikawaTools.npcList[20] = true
  29. horikawaTools.npcList[21] = false
  30. horikawaTools.npcList[22] = false
  31. horikawaTools.npcList[23] = true
  32. horikawaTools.npcList[24] = true
  33. horikawaTools.npcList[25] = true
  34. horikawaTools.npcList[26] = false
  35. horikawaTools.npcList[27] = true
  36. horikawaTools.npcList[28] = true
  37. horikawaTools.npcList[29] = true
  38. horikawaTools.npcList[30] = false
  39. horikawaTools.npcList[31] = false
  40. horikawaTools.npcList[32] = false
  41. horikawaTools.npcList[33] = false
  42. horikawaTools.npcList[34] = false
  43. horikawaTools.npcList[35] = false
  44. horikawaTools.npcList[36] = true
  45. horikawaTools.npcList[37] = true
  46. horikawaTools.npcList[38] = true
  47. horikawaTools.npcList[39] = true
  48. horikawaTools.npcList[40] = false
  49. horikawaTools.npcList[41] = false
  50. horikawaTools.npcList[42] = true
  51. horikawaTools.npcList[43] = true
  52. horikawaTools.npcList[44] = 2
  53. horikawaTools.npcList[45] = false
  54. horikawaTools.npcList[46] = false
  55. horikawaTools.npcList[47] = true
  56. horikawaTools.npcList[48] = true
  57. horikawaTools.npcList[49] = true
  58. horikawaTools.npcList[50] = true
  59. horikawaTools.npcList[51] = true
  60. horikawaTools.npcList[52] = true
  61. horikawaTools.npcList[53] = true
  62. horikawaTools.npcList[54] = true
  63. horikawaTools.npcList[55] = true
  64. horikawaTools.npcList[56] = false
  65. horikawaTools.npcList[57] = false
  66. horikawaTools.npcList[58] = false
  67. horikawaTools.npcList[59] = true
  68. horikawaTools.npcList[60] = false
  69. horikawaTools.npcList[61] = true
  70. horikawaTools.npcList[62] = false
  71. horikawaTools.npcList[63] = true
  72. horikawaTools.npcList[64] = false
  73. horikawaTools.npcList[65] = true
  74. horikawaTools.npcList[66] = false
  75. horikawaTools.npcList[67] = false
  76. horikawaTools.npcList[68] = false
  77. horikawaTools.npcList[69] = false
  78. horikawaTools.npcList[70] = false
  79. horikawaTools.npcList[71] = true
  80. horikawaTools.npcList[72] = true
  81. horikawaTools.npcList[73] = true
  82. horikawaTools.npcList[74] = true
  83. horikawaTools.npcList[75] = false
  84. horikawaTools.npcList[76] = true
  85. horikawaTools.npcList[77] = true
  86. horikawaTools.npcList[78] = false
  87. horikawaTools.npcList[79] = false
  88. horikawaTools.npcList[80] = false
  89. horikawaTools.npcList[81] = false
  90. horikawaTools.npcList[82] = false
  91. horikawaTools.npcList[83] = false
  92. horikawaTools.npcList[84] = false
  93. horikawaTools.npcList[85] = false
  94. horikawaTools.npcList[86] = true
  95. horikawaTools.npcList[87] = false
  96. horikawaTools.npcList[88] = false
  97. horikawaTools.npcList[89] = true
  98. horikawaTools.npcList[90] = false
  99. horikawaTools.npcList[91] = false
  100. horikawaTools.npcList[92] = false
  101. horikawaTools.npcList[93] = true
  102. horikawaTools.npcList[94] = false
  103. horikawaTools.npcList[95] = false
  104. horikawaTools.npcList[96] = false
  105. horikawaTools.npcList[97] = false
  106. horikawaTools.npcList[98] = false
  107. horikawaTools.npcList[99] = false
  108. horikawaTools.npcList[100] = false
  109. horikawaTools.npcList[101] = false
  110. horikawaTools.npcList[102] = false
  111. horikawaTools.npcList[103] = false
  112. horikawaTools.npcList[104] = false
  113. horikawaTools.npcList[105] = false
  114. horikawaTools.npcList[106] = false
  115. horikawaTools.npcList[107] = false
  116. horikawaTools.npcList[108] = true
  117. horikawaTools.npcList[109] = true
  118. horikawaTools.npcList[110] = true
  119. horikawaTools.npcList[111] = true
  120. horikawaTools.npcList[112] = true
  121. horikawaTools.npcList[113] = true
  122. horikawaTools.npcList[114] = true
  123. horikawaTools.npcList[115] = true
  124. horikawaTools.npcList[116] = true
  125. horikawaTools.npcList[117] = true
  126. horikawaTools.npcList[118] = true
  127. horikawaTools.npcList[119] = true
  128. horikawaTools.npcList[120] = true
  129. horikawaTools.npcList[121] = true
  130. horikawaTools.npcList[122] = true
  131. horikawaTools.npcList[123] = true
  132. horikawaTools.npcList[124] = true
  133. horikawaTools.npcList[125] = true
  134. horikawaTools.npcList[126] = true
  135. horikawaTools.npcList[127] = true
  136. horikawaTools.npcList[128] = true
  137. horikawaTools.npcList[129] = true
  138. horikawaTools.npcList[130] = true
  139. horikawaTools.npcList[131] = true
  140. horikawaTools.npcList[132] = true
  141. horikawaTools.npcList[133] = false
  142. horikawaTools.npcList[134] = false
  143. horikawaTools.npcList[135] = true
  144. horikawaTools.npcList[136] = true
  145. horikawaTools.npcList[137] = true
  146. horikawaTools.npcList[138] = false
  147. horikawaTools.npcList[139] = false
  148. horikawaTools.npcList[140] = false
  149. horikawaTools.npcList[141] = false
  150. horikawaTools.npcList[142] = false
  151. horikawaTools.npcList[143] = false
  152. horikawaTools.npcList[144] = false
  153. horikawaTools.npcList[145] = false
  154. horikawaTools.npcList[146] = false
  155. horikawaTools.npcList[147] = false
  156. horikawaTools.npcList[148] = false
  157. horikawaTools.npcList[149] = false
  158. horikawaTools.npcList[150] = false
  159. horikawaTools.npcList[151] = false
  160. horikawaTools.npcList[152] = false
  161. horikawaTools.npcList[153] = false
  162. horikawaTools.npcList[154] = false
  163. horikawaTools.npcList[155] = false
  164. horikawaTools.npcList[156] = false
  165. horikawaTools.npcList[157] = false
  166. horikawaTools.npcList[158] = false
  167. horikawaTools.npcList[159] = false
  168. horikawaTools.npcList[160] = false
  169. horikawaTools.npcList[161] = true
  170. horikawaTools.npcList[162] = true
  171. horikawaTools.npcList[163] = true
  172. horikawaTools.npcList[164] = true
  173. horikawaTools.npcList[165] = true
  174. horikawaTools.npcList[166] = true
  175. horikawaTools.npcList[167] = true
  176. horikawaTools.npcList[168] = true
  177. horikawaTools.npcList[169] = false
  178. horikawaTools.npcList[170] = false
  179. horikawaTools.npcList[171] = false
  180. horikawaTools.npcList[172] = true
  181. horikawaTools.npcList[173] = true
  182. horikawaTools.npcList[174] = true
  183. horikawaTools.npcList[175] = true
  184. horikawaTools.npcList[176] = true
  185. horikawaTools.npcList[177] = true
  186. horikawaTools.npcList[178] = false
  187. horikawaTools.npcList[179] = false
  188. horikawaTools.npcList[180] = true
  189. horikawaTools.npcList[181] = false
  190. horikawaTools.npcList[182] = false
  191. horikawaTools.npcList[183] = false
  192. horikawaTools.npcList[184] = false
  193. horikawaTools.npcList[185] = false
  194. horikawaTools.npcList[186] = false
  195. horikawaTools.npcList[187] = false
  196. horikawaTools.npcList[188] = false
  197. horikawaTools.npcList[189] = true
  198. horikawaTools.npcList[190] = false
  199. horikawaTools.npcList[191] = false
  200. horikawaTools.npcList[192] = false
  201. horikawaTools.npcList[193] = false
  202. horikawaTools.npcList[194] = true
  203. horikawaTools.npcList[195] = true
  204. horikawaTools.npcList[196] = false
  205. horikawaTools.npcList[197] = false
  206. horikawaTools.npcList[198] = false
  207. horikawaTools.npcList[199] = true
  208. horikawaTools.npcList[200] = true
  209. horikawaTools.npcList[201] = true
  210. horikawaTools.npcList[202] = false
  211. horikawaTools.npcList[203] = true
  212. horikawaTools.npcList[204] = true
  213. horikawaTools.npcList[205] = true
  214. horikawaTools.npcList[206] = true
  215. horikawaTools.npcList[207] = true
  216. horikawaTools.npcList[208] = 2
  217. horikawaTools.npcList[209] = 2
  218. horikawaTools.npcList[210] = true
  219. horikawaTools.npcList[211] = false
  220. horikawaTools.npcList[212] = false
  221. horikawaTools.npcList[213] = false
  222. horikawaTools.npcList[214] = false
  223. horikawaTools.npcList[215] = false
  224. horikawaTools.npcList[216] = false
  225. horikawaTools.npcList[217] = false
  226. horikawaTools.npcList[218] = false
  227. horikawaTools.npcList[219] = false
  228. horikawaTools.npcList[220] = false
  229. horikawaTools.npcList[221] = false
  230. horikawaTools.npcList[222] = false
  231. horikawaTools.npcList[223] = false
  232. horikawaTools.npcList[224] = false
  233. horikawaTools.npcList[225] = false
  234. horikawaTools.npcList[226] = false
  235. horikawaTools.npcList[227] = false
  236. horikawaTools.npcList[228] = false
  237. horikawaTools.npcList[229] = true
  238. horikawaTools.npcList[230] = true
  239. horikawaTools.npcList[231] = true
  240. horikawaTools.npcList[232] = true
  241. horikawaTools.npcList[233] = true
  242. horikawaTools.npcList[234] = true
  243. horikawaTools.npcList[235] = true
  244. horikawaTools.npcList[236] = true
  245. horikawaTools.npcList[237] = false
  246. horikawaTools.npcList[238] = false
  247. horikawaTools.npcList[239] = false
  248. horikawaTools.npcList[240] = false
  249. horikawaTools.npcList[241] = false
  250. horikawaTools.npcList[242] = true
  251. horikawaTools.npcList[243] = true
  252. horikawaTools.npcList[244] = true
  253. horikawaTools.npcList[245] = true
  254. horikawaTools.npcList[246] = false
  255. horikawaTools.npcList[247] = true
  256. horikawaTools.npcList[248] = false
  257. horikawaTools.npcList[249] = false
  258. horikawaTools.npcList[250] = false
  259. horikawaTools.npcList[251] = false
  260. horikawaTools.npcList[252] = false
  261. horikawaTools.npcList[253] = false
  262. horikawaTools.npcList[254] = false
  263. horikawaTools.npcList[255] = false
  264. horikawaTools.npcList[256] = 2
  265. horikawaTools.npcList[257] = 2
  266. horikawaTools.npcList[258] = false
  267. horikawaTools.npcList[259] = false
  268. horikawaTools.npcList[260] = false
  269. horikawaTools.npcList[261] = true
  270. horikawaTools.npcList[262] = true
  271. horikawaTools.npcList[263] = 2
  272. horikawaTools.npcList[264] = false
  273. horikawaTools.npcList[265] = false
  274. horikawaTools.npcList[266] = false
  275. horikawaTools.npcList[267] = 2
  276. horikawaTools.npcList[268] = 2
  277. horikawaTools.npcList[269] = false
  278. horikawaTools.npcList[270] = true
  279. horikawaTools.npcList[271] = true
  280. horikawaTools.npcList[272] = true
  281. horikawaTools.npcList[273] = false
  282. horikawaTools.npcList[274] = false
  283. horikawaTools.npcList[275] = true
  284. horikawaTools.npcList[276] = false
  285. horikawaTools.npcList[277] = false
  286. horikawaTools.npcList[278] = false
  287. horikawaTools.npcList[279] = false
  288. horikawaTools.npcList[280] = 2
  289. horikawaTools.npcList[281] = 2
  290. horikawaTools.npcList[282] = false
  291. horikawaTools.npcList[283] = false
  292. horikawaTools.npcList[284] = true
  293. horikawaTools.npcList[285] = true
  294. horikawaTools.npcList[286] = true
  295. horikawaTools.npcList[287] = false
  296. horikawaTools.npcList[288] = false
  297. horikawaTools.npcList[289] = false
  298. horikawaTools.npcList[290] = false
  299. horikawaTools.npcList[291] = false
  300. horikawaTools.npcList[292] = false
  301.  
  302. horikawaTools.powerUps = {}
  303. horikawaTools.powerUps[9] = true
  304. horikawaTools.powerUps[14] = true
  305. horikawaTools.powerUps[34] = true
  306. horikawaTools.powerUps[90] = true
  307. horikawaTools.powerUps[169] = true
  308. horikawaTools.powerUps[170] = true
  309. horikawaTools.powerUps[182] = true
  310. horikawaTools.powerUps[183] = true
  311. horikawaTools.powerUps[184] = true
  312. horikawaTools.powerUps[185] = true
  313. horikawaTools.powerUps[186] = true
  314. horikawaTools.powerUps[187] = true
  315. horikawaTools.powerUps[249] = true
  316. horikawaTools.powerUps[264] = true
  317. horikawaTools.powerUps[273] = true
  318. horikawaTools.powerUps[277] = true
  319. horikawaTools.powerUps[287] = true
  320.  
  321. horikawaTools.powerUpList = {273, 187, 186, 90, 249, 185, 184, 9, 183, 182, 14, 277, 264, 170, 287, 169, 34}
  322. horikawaTools.unHittableNPCs = {9, 10, 11, 13, 14, 16, 21, 22, 26, 30, 31, 32, 33, 34, 35, 40, 41, 45, 46, 56, 57, 58, 60, 62, 64, 66, 67, 68, 69, 70, 75, 78, 79, 80, 81, 82, 83, 84, 85, 87, 88, 90, 91, 92, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 133, 134, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 169, 170, 171, 178, 179, 181, 182, 183, 184, 185, 186, 187, 188, 190, 191, 192, 193, 196, 197, 198, 202, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 237, 238, 239, 240, 241, 246, 248, 249, 250, 251, 252, 253, 254, 255, 258, 259, 260, 264, 265, 266, 269, 273, 274, 276, 277, 278, 279, 282, 283, 287, 288, 289, 290, 291, 292}
  323. horikawaTools.multiHitNPCs = {15, 44, 208, 209, 256, 257, 263, 267, 268, 280, 281}
  324. horikawaTools.hittableNPCs = {1, 2, 3, 4, 5, 6, 7, 8, 12, 15, 17, 18, 19, 20, 23, 24, 25, 27, 28, 29, 36, 37, 38, 39, 42, 43, 44, 47, 48, 49, 50, 51, 52, 53, 54, 55, 59, 61, 63, 65, 71, 72, 73, 74, 76, 77, 86, 89, 93, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 135, 136, 137, 161, 162, 163, 164, 165, 166, 167, 168, 172, 173, 174, 175, 176, 177, 180, 189, 194, 195, 199, 200, 201, 203, 204, 205, 206, 207, 208, 209, 210, 229, 230, 231, 232, 233, 234, 235, 236, 242, 243, 244, 245, 247, 256, 257, 261, 262, 263, 267, 268, 270, 271, 272, 275, 280, 281, 284, 285, 286}
  325.  
  326. function horikawaTools.tableConcat(t1, t2)
  327.         for i=1,#t2 do
  328.                 t1[#t1+1] = t2[i]
  329.         end
  330.         return t1
  331. end
  332.  
  333. function horikawaTools.transformWorldCoordinates(x, y)
  334.         return x - world.playerX, y - world.playerY
  335. end
  336.  
  337. function horikawaTools.coordinatesToPixels(xCoordinate, yCoordinate)
  338.         local leftSide, rightSide, topSide, bottomSide, returnX, returnY
  339.         leftSide = math.floor(player.x) - player.screen.left
  340.         rightSide = math.floor(player.x) + player.screen.right
  341.         topSide = math.floor(player.y) - player.screen.top
  342.         bottomSide = math.floor(player.y) + player.screen.bottom
  343.         returnX = xCoordinate - leftSide
  344.         returnY = yCoordinate - topSide
  345.         return returnX, returnY
  346. end
  347.  
  348.  
  349. function horikawaTools.spairs(t, order)
  350.         -- collect the keys
  351.         local keys = {}
  352.         for k in pairs(t) do keys[#keys+1] = k end
  353.  
  354.         -- if order function given, sort by it by passing the table and keys a, b,
  355.         -- otherwise just sort the keys
  356.         if order then
  357.                 table.sort(keys, function(a,b) return order(t, a, b) end)
  358.         else
  359.                 table.sort(keys)
  360.         end
  361.  
  362.         -- return the iterator function
  363.         local i = 0
  364.         return function()
  365.                 i = i + 1
  366.                 if keys[i] then
  367.                         return keys[i], t[keys[i]]
  368.                 end
  369.         end
  370. end
  371.  
  372. function horikawaTools.freezePlayer(pauseMusic, pauseSound, playerX, playerY)
  373.         pauseMusic = pauseMusic or false
  374.         pauseSound = pauseSound or false
  375.         playerX = playerX or player.x
  376.         playerY = playerY or player.y
  377.         mem(0x00B2C8B4, FIELD_WORD, -1)
  378.         player.x = playerX
  379.         player.y = playerY
  380.         player:mem(0x04, FIELD_WORD, -1)
  381.         player:mem(0x11E, FIELD_WORD, 1)
  382.         if pauseMusic then
  383.                 Audio.SeizeStream(-1)
  384.                 Audio.MusicPause()
  385.         end
  386.         if pauseSound then
  387.                 Audio.SfxPause(-1)
  388.         end
  389. end
  390.  
  391. function horikawaTools.makePlayerInvisible()
  392.         player:mem(0x140, FIELD_WORD, 2)
  393.         player:mem(0x142, FIELD_WORD, -1)
  394. end
  395.  
  396.  
  397. function horikawaTools.makeNPCInvisible(npcRef)
  398.         npcRef:mem(0xE4, FIELD_WORD, 255)
  399.         npcRef:mem(0xE8, FIELD_DFLOAT, 0)
  400. end
  401.  
  402. function horikawaTools.removeInvalidNPCS(npcList)
  403.         local i, j
  404.         for i, j in pairs(npcList) do
  405.                 if (not j.isValid) then
  406.                         table.remove(npcList, i)
  407.                 end
  408.         end
  409. end
  410.  
  411. function horikawaTools.unFreezePlayer(musicPaused, soundPaused)
  412.         musicPaused = musicPaused or false
  413.         soundPaused = soundPaused or false
  414.         mem(0x00B2C8B4, FIELD_WORD, 0)
  415.         player:mem(0x04, FIELD_WORD, 0)
  416.         player:mem(0x11E, FIELD_WORD, -1)
  417.         if musicPaused then
  418.                 Audio.MusicResume()
  419.                 Audio.ReleaseStream(-1)
  420.         end
  421.         if soundPaused then
  422.                 Audio.SfxResume(-1)
  423.         end
  424. end
  425.  
  426. function horikawaTools.joinTables(t1, t2)
  427.         for k,v in ipairs(t2) do
  428.                 table.insert(t1, v)
  429.         end
  430.         return t1
  431. end
  432.  
  433. function horikawaTools.isWorthHitting(inputNPC)
  434.         local isHittable, isBoss
  435.         for _, i in pairs(horikawaTools.unHittableNPCS) do
  436.                 if inputNPC.id == i then
  437.                         isHittable = false
  438.                         break
  439.                 else
  440.                         isHittable = true
  441.                 end
  442.         end
  443.         for _, i in pairs(horikawaTools.multiHitNPCs) do
  444.                 if inputNPC.id == i then
  445.                         isBoss = true
  446.                         break
  447.                 else
  448.                         isBoss = false
  449.                 end
  450.         end
  451.         if isHittable and not isBoss then
  452.                 return 1
  453.         elseif isBoss then
  454.                 return 0
  455.         else
  456.                 return false
  457.         end
  458. end
  459.  
  460. function horikawaTools.hitNPC(inputNPC)
  461.         local hitType
  462.         hitType = horikawaTools.isWorthHitting(inputNPC)
  463.         if hitType == 1 then
  464.                 inputNPC:kill()
  465.         elseif hitType == 0 then
  466.                 inputNPC:mem(0x148, FIELD_FLOAT, inputNPC:mem(0x148, FIELD_FLOAT) + 1)
  467.         end
  468. end
  469.  
  470.  
  471. function horikawaTools.findRoot()
  472.         local listOfFiles, directoryString, directoryLevelsUp
  473.         listOfFiles = {}
  474.         directoryLevelsUp = ""
  475.         while (table.getn(listOfFiles) == 0) do
  476.                 directoryString = ".\\" .. directoryLevelsUp .. "LuaScriptsLib"
  477.                 listOfFiles = Misc.listLocalFiles(directoryString)
  478.                 directoryLevelsUp = directoryLevelsUp .. "..\\"
  479.         end
  480.         return directoryString
  481. end
  482.  
  483. return horikawaTools
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top