Advertisement
ZrnecX

Hypna do OpenEUO

Aug 1st, 2015
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.62 KB | None | 0 0
  1. UO.CliNr = 1
  2.  
  3.  
  4. local PoKolikaDelatHypna = 10
  5. local HypnoType = 1 -- ;1=normal;2=quali;
  6.  
  7. function IsThere(what,where)
  8.  
  9. if type(where) ~= "string" then
  10. return
  11. end
  12.  
  13. if type(what) ~= "string" then
  14. if type(what) == "table" then
  15. local FoundItInRecrusion = false
  16. for i=1,#what do
  17. --print(what[i].." in "..where)
  18. if IsThere(what[i],where) then
  19. FoundItInRecrusion = true
  20. end
  21. end
  22. return FoundItInRecrusion
  23. end
  24. return
  25. end
  26.  
  27. if string.find(where, what) ~= nil then
  28. return true
  29. end
  30. return false
  31. end
  32.  
  33.  
  34. local GetBODInfo
  35.  
  36. local GIDFT = {
  37. ["Total Resist"] = function(p)
  38. return
  39. (p["Physical Resist"] or 0) +
  40. (p["Fire Resist"] or 0) +
  41. (p["Cold Resist"] or 0) +
  42. (p["Poison Resist"] or 0) +
  43. (p["Energy Resist"] or 0)
  44. end}
  45.  
  46. local IMT = {}
  47. IMT.__index = function(table,key)
  48. if key == "Name" or key == "Details" then
  49. local Name,Details = UO.Property(table.ID)
  50. rawset(table,"Name",string.match(Name,"[%s%d]*(.+)"))
  51. rawset(table,"Details",Details)
  52. end
  53. if key == "Property" then
  54. local Property = GetItemData(table.Details)
  55. Property.Name = table.Name
  56. rawset(table,"Property",Property)
  57. end
  58. if key == "BODInfo" then
  59. rawset(table,"BODInfo",GetBODInfo(table.Details))
  60. end
  61. return rawget(table,key)
  62. end
  63.  
  64. local CheckProperty = function(find,string,search)
  65. if find.Name == nil then
  66. find.Name,find.Details = UO.Property(find.ID)
  67. end
  68. if type(search[string]) ~= "table" then
  69. return string.find(string.lower(find[string]),string.lower(search[string]),1,true) ~= nil
  70. end
  71. for i=1,#search[string] do
  72. if string.find(string.lower(find[string]),string.lower(search[string][i]),1,true) ~= nil then
  73. return true
  74. end
  75. end
  76. return false
  77. end
  78.  
  79. local CheckValue = function(find,search)
  80. if type(search) ~= "table" then
  81. return find == search
  82. end
  83. for i=1,#search do
  84. if find == search[i] then
  85. return true
  86. end
  87. end
  88. return false
  89. end
  90.  
  91. local Compare = {}
  92. Compare.ID = function(find,search) return CheckValue(find.ID,search.ID) end
  93. Compare.Type = function(find,search) return CheckValue(find.Type,search.Type) end
  94. Compare.Kind = function(find,search) return CheckValue(find.Kind,search.Kind) end
  95. Compare.ContID = function(find,search) return CheckValue(find.ContID,search.ContID) end
  96. Compare.X = function(find,search) return CheckValue(find.X,search.X) end
  97. Compare.Y = function(find,search) return CheckValue(find.Y,search.Y) end
  98. Compare.Z = function(find,search) return CheckValue(find.Z,search.Z) end
  99. Compare.Stack = function(find,search) return CheckValue(find.Stack,search.Stack) end
  100. Compare.Rep = function(find,search) return CheckValue(find.Rep,search.Rep) end
  101. Compare.Col = function(find,search) return CheckValue(find.Col,search.Col) end
  102. Compare.RelX = function(find,search) return CheckValue(find.RelX,search.RelX) end
  103. Compare.RelY = function(find,search) return CheckValue(find.RelY,search.RelY) end
  104. Compare.RelZ = function(find,search) return CheckValue(find.RelZ,search.RelZ) end
  105. Compare.Dist = function(find,search)
  106. if find.Dist == nil then return false end
  107. if type(search.Dist) == "number" then
  108. return find.Dist <= search.Dist
  109. elseif type(search) == "table" then
  110. return CheckValue(find.Dist,search.Dist)
  111. end
  112. end
  113. Compare.Name = function(find,search) return CheckProperty(find,"Name",search) end
  114. Compare.Details = function(find,search) return CheckProperty(find,"Details",search) end
  115. Compare.Func = function(find,search)
  116. if type(search.Func) == "function" then
  117. return search.Func(find)
  118. end
  119. for i=1,#search.Func do
  120. if search.Func[i](find) then
  121. return true
  122. end
  123. end
  124. return false
  125. end
  126.  
  127. local KeyCheck = {["ID"]=0,["Type"]=0,["Kind"]=0,["ContID"]=0,["X"]=0,["Y"]=0,["Z"]=0,["Stack"]=0,["Rep"]=0,["Col"]=0,["RelX"]=0,["RelY"]=0,["RelZ"]=0,["Dist"]=0}
  128. local KeyCheckE = {["Name"]=0,["Details"]=0,["Func"]=0}
  129.  
  130. FindItems = function(t,...)
  131. local r = {}
  132. local t_key_names = {} -- table of true "standard" item properties
  133. local f_key_names = {} -- table of false "standard" properties
  134. local te_key_names = {} -- table of true "extra" properties
  135. local fe_key_names = {} -- table of false "extra" properties
  136. if arg.n == 1 and #arg[1] == 2 then
  137. arg[2] = arg[1][2]
  138. arg[1] = arg[1][1]
  139. arg.n = 2
  140. end
  141. if arg.n == 1 then
  142. arg[2] = {}
  143. end
  144. for k,v in pairs(arg[1]) do
  145. if KeyCheck[k] then
  146. table.insert(t_key_names,k)
  147. elseif KeyCheckE[k] then
  148. table.insert(te_key_names,k)
  149. end
  150. end
  151. for k,v in pairs(arg[2]) do
  152. if KeyCheck[k] then
  153. table.insert(f_key_names,k)
  154. elseif KeyCheckE[k] then
  155. table.insert(fe_key_names,k)
  156. end
  157. end
  158. local t_key_count = #t_key_names
  159. local f_key_count = #f_key_names
  160. local te_key_count = #te_key_names
  161. local fe_key_count = #fe_key_names
  162. for i=1,#t do
  163. local flag = true
  164. if flag == true then
  165. for j=1,t_key_count do
  166. flag = Compare[t_key_names[j]](t[i],arg[1])
  167. if flag == false then break end
  168. end
  169. end
  170. if flag == true then
  171. for j=1,te_key_count do
  172. flag = Compare[te_key_names[j]](t[i],arg[1])
  173. if flag == false then break end
  174. end
  175. end
  176. if flag == true and ( f_key_count > 0 or fe_key_count > 0 ) then
  177. for j=1,f_key_count do
  178. flag = Compare[f_key_names[j]](t[i],arg[2])
  179. if flag == false then break end
  180. end
  181. if flag == true and fe_key_count > 0 then
  182. for j=1,fe_key_count do
  183. flag = Compare[fe_key_names[j]](t[i],arg[2])
  184. if flag == false then break end
  185. end
  186. end
  187. if flag == false then flag = true else flag = false end
  188. end
  189. if flag == true then
  190. table.insert(r,t[i])
  191. end
  192. end
  193. return r
  194. end
  195.  
  196. local CharPos = {}
  197.  
  198. local GetItem = function(i)
  199. local ID,Type,Kind,ContID,X,Y,Z,Stack,Rep,Col = UO.GetItem(i)
  200. local t = {ID=ID,Type=Type,Kind=Kind,ContID=ContID,X=X,Y=Y,Z=Z,Stack=Stack,Rep=Rep,Col=Col}
  201. if t.Kind == 1 then
  202. t.RelX = t.X - CharPos.X
  203. t.RelY = t.Y - CharPos.Y
  204. t.RelZ = t.Z - CharPos.Z
  205. t.Dist = math.max(math.abs(t.RelX),math.abs(t.RelY))
  206. end
  207. return t
  208. end
  209.  
  210. ScanItems = function(bVisOnly,...)
  211. if bVisOnly == nil then
  212. bVisOnly = true
  213. end
  214. local t = {}
  215. CharPos.X = UO.CharPosX
  216. CharPos.Y = UO.CharPosY
  217. CharPos.Z = UO.CharPosZ
  218. for i=0,UO.ScanItems(bVisOnly)-1 do
  219. local item = GetItem(i)
  220. setmetatable(item,IMT)
  221. table.insert(t,item)
  222. end
  223. if ... ~= nil then
  224. t = FindItems(t,...)
  225. end
  226. return t
  227. end
  228.  
  229. ScanItemsEx = function(bVisOnly,...)
  230. ---------------------------------------------
  231. -- make a list of all containers on screen --
  232. ---------------------------------------------
  233. local c = ScanConts()
  234. ---------------------------------------------------------------------
  235. -- list all paperdoll ids they throw off the .RelX and .RelY value --
  236. ---------------------------------------------------------------------
  237. local PaperDolls = {}
  238. do
  239. local temp = FindConts(c,{Name="paperdoll gump"})
  240. for i=1,#temp do
  241. table.insert(PaperDolls,temp[i].ID)
  242. end
  243. end
  244. --------------------------------------------------------------------------------
  245. -- .Dist property of 'c' table will be distance to ground level container --
  246. -- .X property of 'c' table will be the world x position of that container --
  247. -- .Y property of 'c' table will be the world y position of that container --
  248. -- some containers will not have an ID and will have no .Dist,.X or .Y values --
  249. --------------------------------------------------------------------------------
  250. local t = ScanItems(bVisOnly)
  251. for i=1,#c do
  252. local Parent = 0
  253. local SearchID = c[i].ID
  254. while true do
  255. if SearchID == nil then
  256. break
  257. end
  258. ---------------------------------------------------------
  259. -- search for SearchID exclude IDs found on paperdolls --
  260. ---------------------------------------------------------
  261. local Item = FindItems(t,{ID=SearchID},{ContID=PaperDolls})
  262. if #Item == 0 then
  263. break
  264. end
  265. if Item[1].Kind == 1 then
  266. c[i].Dist = Item[1].Dist
  267. c[i].X = Item[1].X
  268. c[i].Y = Item[1].Y
  269. break
  270. end
  271. SearchID = Item[1].ContID
  272. end
  273. end
  274. ---------------------------------------------------------------
  275. -- assign the container items X,Y,RelX, RelY and Dist values --
  276. ---------------------------------------------------------------
  277. for i=1,#t do
  278. if t[i].Kind == 0 then
  279. for j=1,#c do
  280. if t[i].ContID == c[j].ID then
  281. t[i].RelX = t[i].X - c[j].X
  282. t[i].RelY = t[i].Y - c[j].Y
  283. t[i].Dist = c[j].Dist
  284. t[i].X = c[j].X
  285. t[i].Y = c[j].Y
  286. break
  287. end
  288. end
  289. end
  290. end
  291. -----------------------------------------------
  292. -- search for items using supplied filter(s) --
  293. -----------------------------------------------
  294. if ... ~= nil then
  295. t = FindItems(t,...)
  296. end
  297. return t
  298. end
  299.  
  300. ScanInvisItems = function(...)
  301. local t = {}
  302. local t1 = {}
  303. CharPos.X = UO.CharPosX
  304. CharPos.Y = UO.CharPosY
  305. for i=0,UO.ScanItems(true)-1 do
  306. t1[UO.GetItem(i)] = 0
  307. end
  308. for i=0,UO.ScanItems(false)-1 do
  309. local item = GetItem(i)
  310. if t1[item.ID] == nil then
  311. setmetatable(item,IMT)
  312. table.insert(t,item)
  313. end
  314. end
  315. if ... ~= nil then
  316. t = FindItems(t,...)
  317. end
  318. return t
  319. end
  320.  
  321. local IgnoreItem_sub1 = function(Table,IDType,Name)
  322. -----------------------------------
  323. -- is IDType a command to reset? --
  324. -----------------------------------
  325. if type(IDType) == "string" and string.lower(IDType) == "reset" then
  326. if Name == nil then
  327. Table = {}
  328. --[[
  329. for k,v in pairs(Table) do
  330. Table[k] = nil
  331. end
  332. Table["ID"] = nil
  333. Table["Type"] = nil
  334. Table["Group"] = nil
  335. ]]--
  336. else
  337. if Table.Group[Name] ~= nil then
  338. local Group = Table.Group[Name]
  339. for i=#Group,1,-1 do
  340. IgnoreItem(Table,Group[i])
  341. end
  342. end
  343. end
  344. return
  345. end
  346. -----------------------------
  347. -- is IDType a Type or ID? --
  348. -----------------------------
  349. local CodeType
  350. if IDType < 65536 then
  351. CodeType = "Type"
  352. else
  353. CodeType = "ID"
  354. end
  355. -----------------------------------------------
  356. -- remove IDType from group if exists in one --
  357. -----------------------------------------------
  358. if Table["Group"] == nil then
  359. Table.Group = {}
  360. end
  361. for GroupName,Group in pairs(Table.Group) do
  362. for i=1,#Group do
  363. if Group[i] == IDType then
  364. table.remove(Group,i)
  365. end
  366. end
  367. if #Group == 0 then
  368. Table.Group[GroupName] = nil
  369. end
  370. end
  371. -------------------------------------------------------
  372. -- remove IDType from ignore list if it exists in it --
  373. -------------------------------------------------------
  374. if Table[CodeType] == nil then
  375. Table[CodeType] = {}
  376. else
  377. for i=1,#Table[CodeType] do
  378. if Table[CodeType][i] == IDType then
  379. table.remove(Table[CodeType],i)
  380. if #Table[CodeType] == 0 then
  381. Table[CodeType] = nil
  382. end
  383. return
  384. end
  385. end
  386. end
  387. -------------------------
  388. -- add IDType to group --
  389. -------------------------
  390. if Name ~= nil then
  391. if Table.Group[Name] == nil then
  392. Table.Group[Name] = {}
  393. end
  394. table.insert(Table.Group[Name],IDType)
  395. end
  396. --------------------------------
  397. -- add IDType to ignore table --
  398. --------------------------------
  399. table.insert(Table[CodeType],IDType)
  400. end
  401.  
  402. IgnoreItem = function(Table,IDTypeTable,Name)
  403. if type(IDTypeTable) ~= "table" then
  404. IgnoreItem_sub1(Table,IDTypeTable,Name)
  405. else
  406. for i=1,#IDTypeTable do
  407. IgnoreItem_sub1(Table,IDTypeTable[i],Name)
  408. end
  409. end
  410. end
  411.  
  412. -----------------------------------------------------------
  413. -- load a table with information about a bulk order deed --
  414. -----------------------------------------------------------
  415. GetBODInfo = function(Details)
  416. ----------------------------------
  417. -- get the details about an BOD --
  418. ----------------------------------
  419. if type(Details) == "number" then
  420. local Name
  421. Name,Details = UO.Property(Details)
  422. if Name ~= "A Bulk Order Deed" or string.len(Details) == 0 then
  423. print("GetBODInfo - error item ID:"..ID.." is not a BOD")
  424. return nil
  425. end
  426. end
  427. ----------------------------------------------------------------------------
  428. -- string.gfind function returns 1 line of info from the details per call --
  429. -- then either the entire line or part of it is written to the table --
  430. ----------------------------------------------------------------------------
  431. local GetLine = string.gfind(Details,"([^%c]+)%c*")
  432. GetLine() -- Blessed
  433. GetLine() -- Weight: 1 Stone
  434. local RetVal = {}
  435. RetVal["Size"] = GetLine()
  436. RetVal["Material"] = GetLine()
  437. RetVal["Quality"] = GetLine()
  438. RetVal["Amount"] = tonumber(string.match(GetLine(),"[%w%s]+: (%d+)"))
  439. for i=1,6 do
  440. local Line = GetLine()
  441. if Line == nil then
  442. break
  443. end
  444. RetVal[i] = {}
  445. RetVal[i]["Name"] = string.match(Line,"([%w%s-']+)")
  446. RetVal[i]["Amount"] = tonumber(string.match(Line,"[%w%s]+: (%d+)"))
  447. end
  448. return RetVal
  449. end
  450.  
  451. local Reg = {gi=3973,mr=3974,bm=3963,ss=3981,sa=3980,ns=3976,bp=3962,ga=3972}
  452. local ArcaneMaterial = Reg.bm -- bm pro quali
  453. if HypnoType == 1 then
  454. ArcaneMaterial = Reg.ss
  455. end
  456. UO.SysMessage("HYPNA HYPNA HYPNA!!!")
  457. wait(500)
  458.  
  459. local DelamSipy = true
  460.  
  461. while DelamSipy do
  462. --Type: 7124 shafts
  463. --Type: 7121 peri
  464. ------
  465. --carvings 3967
  466.  
  467. --bm 3963
  468. --ss 3981
  469. local PoKolikaDelatSipy = PoKolikaDelatHypna
  470.  
  471. -- Najit nejmensi stack shaftu a
  472. -- pokud bude vetsi nez 10 tak odebrat 10 a pouzit tento novy..
  473. Shafty = ScanItems(true,{Type=3967,ContID=UO.BackpackID})
  474. if #Shafty == 0 then
  475. print("Nemas Carvingy!")
  476. return
  477. end
  478.  
  479. local MinimalStack = 60000
  480. local MinimalStackID = 0
  481. for k, item in pairs (Shafty) do
  482. if item.Stack ~= nil and item.Stack ~= 0 then
  483. MinimalStack = math.min(item.Stack,MinimalStack)
  484. if MinimalStack == item.Stack then
  485. MinimalStackID = item.ID
  486. end
  487. end
  488. end
  489.  
  490. if MinimalStack >= (PoKolikaDelatSipy + 1) then
  491. local OldAmount = #Shafty
  492. UO.Drag(MinimalStackID, PoKolikaDelatSipy)
  493. UO.DropC(UO.BackpackID,20,20)
  494. while #Shafty < OldAmount + 1 do
  495. Shafty = ScanItems(true,{Type=3967,ContID=UO.BackpackID})
  496. end
  497.  
  498.  
  499. MinimalStack = 60000
  500. MinimalStackID = 0
  501. for k, item in pairs (Shafty) do
  502. if item.Stack ~= nil and item.Stack ~= 0 then
  503. MinimalStack = math.min(item.Stack,MinimalStack)
  504. if MinimalStack == item.Stack then
  505. MinimalStackID = item.ID
  506. end
  507. end
  508. end
  509. end
  510.  
  511. for k, item in pairs (Shafty) do
  512. if item.Stack ~= nil and item.Stack ~= 0 then
  513. MinimalStack = math.min(item.Stack,MinimalStack)
  514. if MinimalStack == item.Stack then
  515. MinimalStackID = item.ID
  516. end
  517. end
  518. end
  519. -- print("Delam!")
  520. Peri = ScanItems(true,{Type=ArcaneMaterial,ContID=UO.BackpackID})
  521. if #Peri == 0 then
  522. print("Nemas u sebe regy!")
  523. return
  524. end
  525. FeatherID = Peri[1].ID
  526.  
  527. print("Carvings: "..MinimalStackID.."=>"..MinimalStack)
  528. print("Regents: "..FeatherID)
  529.  
  530. UO.LObjectID = MinimalStackID
  531. UO.Macro(17,0)
  532.  
  533. while UO.TargCurs == false do
  534. wait(10)
  535. end
  536.  
  537. while UO.TargCurs == true do
  538. UO.LTargetID = FeatherID
  539. UO.LTargetKind = 1
  540. UO.Macro(22,0)
  541. wait(30)
  542. end
  543.  
  544.  
  545. CekamNaDalsiKolecko = true
  546. while CekamNaDalsiKolecko do
  547. if IsThere("create some",UO.SysMsg) then
  548. CekamNaDalsiKolecko = false
  549. end
  550. if IsThere("destroy",UO.SysMsg) then
  551. CekamNaDalsiKolecko = false
  552. end
  553. end
  554.  
  555. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement