Advertisement
ZrnecX

Untitled

Aug 20th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.61 KB | None | 0 0
  1. --[[
  2. ;----------------------------------
  3. ; Script Name: FindConts.lua
  4. ; Author: Kal In Ex
  5. ; Version: 1.5
  6. ; Client Tested with: 7.0.10.1 (Patch 95)
  7. ; EUO version tested with: OpenEUO 0.91.0008
  8. ; Shard OSI / FS: OSI
  9. ; Revision Date: December 19, 2010
  10. ; Public Release: October 26, 2010
  11. ; Purpose: A "FindItem" for containers
  12. ; Copyright: 2010 Kal In Ex
  13. ;---------------------------------- ]]---
  14.  
  15. local CheckValue = function(bool,find,search)
  16. if type(search) ~= "table" then
  17. if find == search then
  18. if bool == true then return true else return false end
  19. end
  20. if bool == true then return false else return true end
  21. end
  22. for k,value in pairs(search) do
  23. if find == value then
  24. if bool == true then return true else return false end
  25. end
  26. end
  27. if bool == true then return false else return true end
  28. end
  29.  
  30. FindContsK = function(t,...)
  31. local r = {}
  32. local t_key_names = {} -- table of true "standard" item properties
  33. local f_key_names = {} -- table of false "standard" properties
  34. if arg.n == 1 and #arg[1] == 2 then
  35. arg[2] = arg[1][2]
  36. arg[1] = arg[1][1]
  37. arg.n = 2
  38. end
  39. if arg.n == 1 then
  40. arg[2] = {}
  41. end
  42. for k,v in pairs(arg[1]) do
  43. if string.find("|Name|X|Y|SX|SY|Kind|ID|Type|HP|","|"..k.."|",1,true) then
  44. table.insert(t_key_names,k)
  45. end
  46. end
  47. for k,v in pairs(arg[2]) do
  48. if string.find("|Name|X|Y|SX|SY|Kind|ID|Type|HP|","|"..k.."|",1,true) then
  49. table.insert(f_key_names,k)
  50. end
  51. end
  52. for i=1,#t do
  53. local flag = true
  54. for j=1,#t_key_names do
  55. flag = CheckValue(true,t[i][t_key_names[j]],arg[1][t_key_names[j]])
  56. if flag == false then break end
  57. end
  58. if flag == true then
  59. for j=1,#f_key_names do
  60. flag = CheckValue(false,t[i][f_key_names[j]],arg[2][f_key_names[j]])
  61. if flag == false then break end
  62. end
  63. end
  64. if flag == true then
  65. table.insert(r,t[i])
  66. end
  67. end
  68. return r
  69. end
  70.  
  71. local GetCont = function(i)
  72. local t = {Index = i}
  73. t.Name,t.X,t.Y,t.SX,t.SY,t.Kind,t.ID,t.Type,t.HP = UO.GetCont(i)
  74. return t
  75. end
  76. --[[
  77. ScanConts_V1 = function(...)
  78. local t = {}
  79. for i=0,99 do
  80. local c = GetCont(i)
  81. if c.Name == "GameAreaEdgeGump" or c.Name == nil then
  82. break
  83. end
  84. table.insert(t,c)
  85. end
  86. if ... ~= nil then
  87. t = FindConts(t,...)
  88. end
  89. return t
  90. end
  91.  
  92. -- ]]---
  93. ScanContsK = function(...)
  94. local t = {}
  95. local scanlimit = 999
  96. local varg = {...}
  97. if #varg == 1 and type(varg[1]) == "number" then
  98. scanlimit = varg[1] - 1
  99. table.remove(varg,1)
  100. end
  101. if #varg == 2 and type(varg[2]) == "number" then
  102. scanlimit = varg[2] - 1
  103. table.remove(varg,2)
  104. end
  105. if #varg == 3 and type(varg[3]) == "number" then
  106. scanlimit = varg[3] - 1
  107. table.remove(varg,3)
  108. end
  109. for i=0,scanlimit do
  110. local c = GetCont(i)
  111. if c.Name == "GameAreaEdgeGump" or c.Name == nil then
  112. break
  113. end
  114. table.insert(t,c)
  115. end
  116. if #varg ~= 0 then
  117. t = FindContsK(t,unpack(varg))
  118. end
  119. return t
  120. end
  121.  
  122. WaitConts = function(bVis,Delay,...)
  123. local result = {}
  124. if bVis == true then
  125. local TimeOUT = getticks() + Delay
  126. while true do
  127. result = ScanConts(...)
  128. if #result ~= 0 or getticks() >= TimeOUT then
  129. return result
  130. end
  131. wait(1)
  132. end
  133. return result
  134. end
  135. if bVis == false then
  136. local TimeOUT = getticks() + Delay
  137. while true do
  138. result = ScanConts(...)
  139. if #result == 0 or getticks() >= TimeOUT then
  140. return result
  141. end
  142. wait(1)
  143. end
  144. return result
  145. end
  146. return result
  147. end
  148.  
  149. WaitCont = WaitConts
  150.  
  151. function MoveConts(XPos,YPos,GumpX,GumpY,...)
  152. local cont
  153. for try=1,2 do
  154. cont = ScanConts(...)
  155. if #cont == 0 or ( cont[1].X == XPos and cont[1].Y == YPos ) then
  156. break
  157. end
  158. local DestX = XPos + GumpX
  159. local DestY = YPos + GumpY
  160. local GrabX = GumpX + cont[1].X
  161. local GrabY = GumpY + cont[1].Y
  162. local CursorX = UO.CursorX
  163. local CursorY = UO.CursorY
  164. if cont[1].Index ~= 0 then
  165. UO.ContTop(cont[1].Index)
  166. wait(100)
  167. end
  168. UO.Click(DestX,DestY,true,false,true,true)
  169. local timeout = getticks() + 1000
  170. UO.Click(GrabX,GrabY,true,true,false,false)
  171. while true do
  172. UO.Click(GrabX,GrabY,true,false,false,false)
  173. wait(1)
  174. cont = ScanConts(...)
  175. if #cont ~= 0 and cont[1].X == XPos and cont[1].Y == YPos then
  176. break
  177. end
  178. if getticks() >= timeout then
  179. break
  180. end
  181. end
  182. UO.Click(DestX,DestY,true,false,true,true)
  183. UO.Click(CursorX,CursorY,true,false,false,true)
  184. end
  185. if #cont == 0 then
  186. return false
  187. end
  188. if cont[1].X ~= XPos or cont[1].Y ~= YPos then
  189. return false
  190. end
  191. return true
  192. end
  193. --[[ ]]--
  194. MoveCont = MoveConts
  195.  
  196. ClickConts = function(XPos,YPos,Left,Down,Up,MC,...)
  197. local cont = ScanConts(...)
  198. if #cont ~= 0 then
  199. XPos = XPos + cont[1].X
  200. YPos = YPos + cont[1].Y
  201. UO.Click(XPos,YPos,Left,Down,Up,MC)
  202. end
  203. return cont
  204. end
  205.  
  206.  
  207. DropToPD = function()
  208.  
  209. UO.Click(UO.CursorX,UO.CursorY,false,false,true,false)
  210. local cont = ScanConts({Name={"paperdoll gump"},ID={UO.CharID}})
  211. while #cont < 1 do
  212. UO.Macro(8,1)
  213. cont = ScanConts({Name={"paperdoll gump"},ID={UO.CharID}})
  214. end
  215.  
  216. if #cont ~= 0 then
  217. local sX,sY = UO.CursorX,UO.CursorY
  218. while sX == nil or sY == nil do
  219. sX,sY = UO.CursorX,UO.CursorY
  220. end
  221. local XPos = 30 + cont[1].X
  222. local YPos = 130 + cont[1].Y
  223. --UO.Click(XPos,YPos,Left,Down,Up,MC)
  224. while UO.LLiftedKind == 1 do
  225. UO.Click(XPos,YPos,true,true,true,true)
  226. wait(35)
  227. end
  228.  
  229. while UO.CursorX ~= sX or sY ~= UO.CursorY do
  230. UO.Click(sX,sY,true,false,false,true)
  231. end
  232. end
  233. return cont
  234. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement