Advertisement
UnitNVMe

Untitled

Sep 19th, 2024 (edited)
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.86 KB | None | 0 0
  1. local config = {
  2. map = 1,
  3. x = 100,
  4. y = 200,
  5. z = 3000
  6. }
  7.  
  8. -- ฟังก์ชันสำหรับการปรับค่าการตั้งค่า
  9. function setConfig(newMap, newX, newY, newZ)
  10. config.map = newMap
  11. config.x = newX
  12. config.y = newY
  13. config.z = newZ
  14. end
  15.  
  16. -- ฟังก์ชันหลัก
  17. function Loop60()
  18. -- รับค่าการพักจากผู้ใช้เป็นวินาที
  19. local input = gg.prompt({
  20. "Sleep เมื่อพบค่า (วินาที)",
  21. "Sleep เมื่อไม่พบค่า (วินาที)"
  22. }, {5, 1}, {"number", "number"}) -- ค่าดีฟอลต์คือ 5 วินาที และ 1 วินาที
  23.  
  24. -- ตรวจสอบว่าผู้ใช้กรอกค่าหรือไม่
  25. if input == nil then
  26. gg.alert("การตั้งค่าถูกยกเลิก")
  27. return
  28. end
  29.  
  30. local sleepWhenFound = input[1] * 1000 -- แปลงเป็นมิลลิวินาที
  31. local sleepWhenNotFound = input[2] * 1000 -- แปลงเป็นมิลลิวินาที
  32.  
  33. -- วาร์ปครั้งแรก
  34. warp256(config.map, config.y, config.x)
  35.  
  36. while true do
  37. -- ดึงรายการข้อมูลจาก Game Guardian
  38. t = gg.getListItems()
  39. local found = false
  40.  
  41. -- ตรวจสอบว่ามีค่าที่ต้องการหรือไม่
  42. for i, v in ipairs(t) do
  43. if v.value == config.z or v.value == 15000 then
  44. found = true
  45. break
  46. end
  47. end
  48.  
  49. -- ถ้าเจอค่า ให้พักตามเวลาที่กำหนด ถ้าไม่เจอ ให้พักเวลาที่สั้นกว่า
  50. if found then
  51. gg.sleep(sleepWhenFound) -- พักตามเวลาที่กำหนดเมื่อเจอค่า
  52. warp256(config.map, config.y, config.x)
  53. else
  54. gg.sleep(sleepWhenNotFound) -- พักเวลาที่กำหนดเมื่อไม่เจอค่า
  55. end
  56. end
  57. end
  58.  
  59. --Module Zone
  60. local ShnMap = "11001~20008;100;0~255::9"
  61. local ShnMapNG = "11001;0;0~255::9"
  62. local ShnMapNG2 = 11001
  63. local RefMap = "11001~20008"
  64. local offsetMap = 0x2C
  65. local offsetX = -4
  66. local offsetY = -12
  67. local offsetNextMap = 0xCC
  68. local offsetAutoSkip = 0xC
  69. local ShnXY = "497;2373;3921;34;2;218;131072::29"
  70. local RefXY = 497
  71. local offsetXYOpen = 0x19C
  72. --Body Zone
  73. local ShnBody = "3;1;1~9999999;1~999999999;-1::21"
  74. local RefBody = 3
  75. local offsetRun = 0x24
  76. local offsetAID = 0xC
  77. --NPC Zone
  78. local ShnNPC = "128;1;2;3;4::17"
  79. local RefNPC = 128
  80. local offsetNPC1 = 4
  81. local offsetNPC2 = 8
  82. local offsetNPC3 = 12
  83. local offsetNPC4 = 16
  84. --Boss Zone
  85. local Drfazen = 1290 local DrfazenM = 2200
  86. local BellArt = 2290 local BellArtM = 2200
  87. function Admin(address,flags,freeze,name,value)
  88. set = {}
  89. set[1] = {}
  90. set[1].address = address
  91. set[1].flags = flags
  92. set[1].value = value
  93. set[1].freeze = freeze
  94. set[1].name = name
  95. gg.setValues(set)
  96. end
  97. local NextMap = 16842753
  98.  
  99. function GetLis() GL = gg.getListItems() gg.toast[[CheckGetLis]] end
  100. function warp(map,x,y)
  101. Admin(GetMap[1].address + offsetMap,4,false,nil,map) gg.addListItems(set)
  102. Admin(GetMap[1].address + offsetX,4,false,nil,x)
  103. Admin(GetMap[1].address + offsetY,4,false,nil,y)
  104. Admin(GetMap[1].address + offsetNextMap,4,false,nil,NextMap)
  105. end
  106. function warp256(map,y,x)
  107. Admin(GetMap[1].address + offsetMap,4,false,"Map",map) gg.addListItems(set)
  108. Admin(GetMap[1].address + offsetX,4,false,nil,x*256)
  109. Admin(GetMap[1].address + offsetY,4,false,nil,y*256)
  110. Admin(GetMap[1].address + offsetNextMap,4,false,nil,NextMap)
  111. end
  112. --Map
  113. local hasRun = false
  114.  
  115. function runOnce()
  116. if not hasRun then
  117. gg.clearResults()
  118. gg.setVisible(false)
  119. gg.searchNumber(ShnXY, gg.TYPE_DWORD)
  120. gg.refineNumber(RefXY, gg.TYPE_DWORD)
  121. gg.setVisible(false)
  122. GetXY = gg.getResults(2)
  123. gg.clearResults()
  124. gg.setVisible(false)
  125. gg.searchNumber(ShnMap, gg.TYPE_DWORD)
  126. gg.refineNumber(RefMap, gg.TYPE_DWORD)
  127. gg.setVisible(false)
  128. GetMap = gg.getResults(2)
  129. if GetMap ~= 11001 and GetMap ~= 20008 then
  130. gg.clearResults()
  131. gg.setVisible(false)
  132. gg.searchNumber(ShnMapNG, gg.TYPE_DWORD)
  133. gg.refineNumber(RefMap, gg.TYPE_DWORD)
  134. gg.setVisible(false)
  135. GetMap = gg.getResults(2)
  136. gg.clearResults()
  137. end
  138. if GetMap ~= 11001 and GetMap ~= 20008 then
  139. gg.clearResults()
  140. gg.setVisible(false)
  141. gg.searchNumber(ShnMapNG2, gg.TYPE_DWORD)
  142. gg.refineNumber(RefMap, gg.TYPE_DWORD)
  143. gg.setVisible(false)
  144. GetMap = gg.getResults(2)
  145. gg.clearResults()
  146. end
  147. hasRun = true
  148. end
  149. end
  150.  
  151. local hasRun = false
  152.  
  153. function EP1()
  154. runOnce()
  155. E1 = gg.choice({
  156. "-เช็คเลขห้อง-",--1
  157. "-วนบอส-",--2
  158. "-นาวาบอส-",--3
  159. "-ออโต้Skip-",--4
  160. "ออก",--5
  161. }, nil, [[NUYACHA]])
  162.  
  163. if E1 == nil then
  164. return
  165. end
  166. if E1 == 1 then CheckMap() end
  167. if E1 == 2 then Loopprom()
  168. end
  169. if E1 == 3 then warp(80010,14848,20480) end
  170. if E1 == 4 then Admin(GetMap[1].address + offsetAutoSkip,4,true,nil,128) gg.addListItems(set)
  171.  
  172. end
  173. if E1 == 5 then
  174. os.exit()
  175. end
  176. end
  177. function GetMapNum(address,name)
  178. O = {}
  179. O[1] = {}
  180. O[1].address = address
  181. O[1].flags = 4
  182. O[1].name = name
  183. O[1].value = value
  184. gg.addListItems(O)
  185. end
  186. function Loopprom()
  187. local fileName = "/storage/emulated/0/Android/NYC.txt" -- ชื่อไฟล์ที่จะบันทึกข้อมูล
  188.  
  189. -- ฟังก์ชันเพื่อบันทึกค่าลงไฟล์
  190. function saveConfig(name, map, x, y, bossMap)
  191. local file, err = io.open(fileName, "a")
  192. if not file then
  193. gg.toast("ไม่สามารถเปิดหรือสร้างไฟล์ได้: " .. (err or "Unknown error"))
  194. return
  195. end
  196.  
  197. local success, writeErr = pcall(function()
  198. file:write(name .. "," .. map .. "," .. x .. "," .. y .. "," .. bossMap .. "\n")
  199. end)
  200. if not success then
  201. gg.toast("ไม่สามารถบันทึกข้อมูลได้: " .. (writeErr or "Unknown error"))
  202. else
  203. gg.toast("บันทึกข้อมูลสำเร็จ")
  204. end
  205. file:close()
  206. end
  207.  
  208. -- ฟังก์ชันเพื่อโหลดค่าจากไฟล์
  209. function loadConfigs()
  210. local configs = {}
  211. local file = io.open(fileName, "r")
  212. if file then
  213. for line in file:lines() do
  214. local name, map, x, y, bossMap = line:match("([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)")
  215. table.insert(configs, {name = name, map = tonumber(map), x = tonumber(x), y = tonumber(y), bossMap = tonumber(bossMap)})
  216. end
  217. file:close()
  218. end
  219. return configs
  220. end
  221.  
  222. -- ฟังก์ชันเพื่อบันทึกไฟล์หลังจากลบหรือแก้ไขข้อมูล
  223. function saveAllConfigs(configs)
  224. local file, err = io.open(fileName, "w")
  225. if not file then
  226. gg.toast("ไม่สามารถเปิดหรือสร้างไฟล์ได้: " .. (err or "Unknown error"))
  227. return
  228. end
  229. for _, config in ipairs(configs) do
  230. file:write(config.name .. "," .. config.map .. "," .. config.x .. "," .. config.y .. "," .. config.bossMap .. "\n")
  231. end
  232. file:close()
  233. gg.toast("อัปเดตไฟล์เรียบร้อยแล้ว")
  234. end
  235.  
  236. -- ฟังก์ชันเพื่อลบเซฟ
  237. function deleteConfig(index)
  238. local configs = loadConfigs()
  239. table.remove(configs, index)
  240. saveAllConfigs(configs)
  241. end
  242.  
  243. -- ฟังก์ชันเพื่อแก้ไขเซฟ
  244. function editConfig(index)
  245. local configs = loadConfigs()
  246. local config = configs[index]
  247. local input = gg.prompt(
  248. {"แก้ไขเลขแมพบอส", "แก้ไข X", "แก้ไข Y", "แก้ไขเลขแมพรอบอส"},
  249. {config.map, config.x, config.y, config.bossMap},
  250. {"number", "number", "number", "number"}
  251. )
  252. if input ~= nil then
  253. configs[index] = {name = config.name, map = input[1], x = input[2], y = input[3], bossMap = input[4]}
  254. saveAllConfigs(configs)
  255. else
  256. gg.toast("ยกเลิกการแก้ไข")
  257. end
  258. end
  259.  
  260. -- ฟังก์ชันแสดงเมนูให้ผู้ใช้เลือกว่าจะโหลดค่า, กรอกข้อมูลใหม่, ลบ หรือแก้ไขข้อมูล
  261. function promptForInput()
  262. local configs = loadConfigs()
  263.  
  264. local choices = {"*เพิ่มเซฟ"}
  265. for i, config in ipairs(configs) do
  266. table.insert(choices, config.name)
  267. end
  268. table.insert(choices, "*ลบเซฟ")
  269. table.insert(choices, "*แก้ไขเซฟ")
  270.  
  271. local choice = gg.choice(choices, nil, "เลือกวิธีการป้อนข้อมูล")
  272.  
  273. if choice == nil then
  274. gg.toast("ยกเลิกการเลือก")
  275. return
  276. elseif choice == 1 then
  277. -- ผู้ใช้เลือกกรอกข้อมูลใหม่
  278. local input = gg.prompt(
  279. {"ใส่เลขแมพบอส", "X", "Y", "เลขแมพรอบอส"},
  280. {5160, 59, 51, 5004}, -- ค่าเริ่มต้น
  281. {"number", "number", "number", "number"}
  282. )
  283.  
  284. if input ~= nil then
  285. -- ตั้งค่าที่รับเข้ามาจาก prompt
  286. local saveName = gg.prompt({"กรอกชื่อเพื่อบันทึกค่า"}, {""}, {"text"})
  287. if saveName ~= nil then
  288. saveConfig(saveName[1], input[1], input[2], input[3], input[4])
  289. end
  290. setConfig(input[1], input[2], input[3], input[4])
  291. Loop60()
  292. else
  293. gg.toast("ยกเลิกการใส่ข้อมูล")
  294. end
  295. elseif choice == #choices - 1 then
  296. -- ผู้ใช้เลือกลบเซฟ
  297. local deleteChoice = gg.choice(choices, nil, "เลือกเซฟที่จะลบ")
  298. if deleteChoice ~= nil and deleteChoice > 1 then
  299. deleteConfig(deleteChoice - 1)
  300. end
  301. elseif choice == #choices then
  302. -- ผู้ใช้เลือกแก้ไขเซฟ
  303. local editChoice = gg.choice(choices, nil, "เลือกเซฟที่จะแก้ไข")
  304. if editChoice ~= nil and editChoice > 1 then
  305. editConfig(editChoice - 1)
  306. end
  307. else
  308. -- ผู้ใช้เลือกค่าเดิมจากไฟล์
  309. local config = configs[choice - 1]
  310. setConfig(config.map, config.x, config.y, config.bossMap)
  311. Loop60()
  312. end
  313. end
  314.  
  315. -- เรียกฟังก์ชันให้ผู้ใช้เลือกวิธีการป้อนข้อมูล
  316. promptForInput()
  317.  
  318. end
  319.  
  320.  
  321. function GetMapNumXY(address,name,value)
  322. O = {}
  323. O[1] = {}
  324. O[1].address = address
  325. O[1].flags = 4
  326. O[1].name = name
  327. O[1].value = value
  328. gg.addListItems(O)
  329. end
  330.  
  331. function CheckMap()
  332. gg.clearList(Map)
  333. GetMapNum(GetMap[1].address + 0x28, "Map")
  334. GetMapNumXY(GetMap[1].address + offsetX, "X")
  335. GetMapNumXY(GetMap[1].address + offsetY, "Y")
  336.  
  337. local H = gg.getListItems()
  338. local map_value, x_value, y_value -- Declare variables to store values
  339.  
  340. -- Find the Map value
  341. for i, v in ipairs(H) do
  342. if v.name == "Map" then
  343. map_value = v.value
  344. break
  345. end
  346. end
  347.  
  348. -- Find the X value
  349. for i, v in ipairs(H) do
  350. if v.name == "X" then
  351. x_value = v.value / 256 -- Scale X value
  352. break
  353. end
  354. end
  355.  
  356. -- Find the Y value
  357. for i, v in ipairs(H) do
  358. if v.name == "Y" then
  359. y_value = v.value / 256 -- Scale Y value
  360. break
  361. end
  362. end
  363.  
  364. -- Display all values together in a single alert and allow copying
  365. if map_value and x_value and y_value then
  366. local output = "Map:"..map_value.." X:"..x_value.." Y:"..y_value
  367. gg.sleep(1000)
  368. gg.alert(output) -- Display the values
  369. gg.copyText(output) -- Copy the values to clipboard
  370. gg.sleep(500)
  371. gg.clearList(Map)
  372. else
  373. gg.alert("Error: Could not retrieve Map, X, or Y values.")
  374. end
  375. end
  376.  
  377.  
  378.  
  379. while true do
  380. if gg.isVisible(true) then
  381. NUX=1
  382. gg.setVisible(false)
  383. end
  384. if NUX==1 then EP1()
  385. NUX=-1
  386. end
  387. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement