Advertisement
ecco7777

CC Base Scanner

Mar 16th, 2018
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.47 KB | None | 0 0
  1. coords={openperipheral_sensor_110={z=345,y=199,x=74,},openperipheral_sensor_45={z=290,y=199,x=-3,},openperipheral_sensor_28={z=268,y=199,x=74,},openperipheral_sensor_25={z=268,y=199,x=41,},openperipheral_sensor_98={z=334,y=199,x=74,},openperipheral_sensor_71={z=312,y=199,x=30,},openperipheral_sensor_61={z=301,y=199,x=52,},openperipheral_sensor_127={z=367,y=199,x=-3,},openperipheral_sensor_67={z=312,y=199,x=-14,},openperipheral_sensor_74={z=312,y=199,x=63,},openperipheral_sensor_85={z=323,y=199,x=63,},openperipheral_sensor_134={z=367,y=199,x=74,},openperipheral_sensor_75={z=312,y=199,x=74,},openperipheral_sensor_141={z=378,y=199,x=19,},openperipheral_sensor_48={z=290,y=199,x=30,},openperipheral_sensor_90={z=334,y=199,x=-14,},openperipheral_sensor_9={z=257,y=199,x=-3,},openperipheral_sensor_120={z=356,y=199,x=52,},openperipheral_sensor_77={z=323,y=199,x=-36,},openperipheral_sensor_24={z=268,y=199,x=30,},openperipheral_sensor_111={z=356,y=199,x=-47,},openperipheral_sensor_42={z=290,y=199,x=-36,},openperipheral_sensor_23={z=268,y=199,x=19,},openperipheral_sensor_116={z=356,y=199,x=8,},openperipheral_sensor_43={z=290,y=199,x=-25,},openperipheral_sensor_18={z=268,y=199,x=-36,},openperipheral_sensor_145={z=378,y=199,x=74,},openperipheral_sensor_91={z=334,y=199,x=-3,},openperipheral_sensor_26={z=268,y=199,x=52,},openperipheral_sensor_96={z=334,y=199,x=52,},openperipheral_sensor_40={z=279,y=199,x=74,},openperipheral_sensor_37={z=279,y=199,x=41,},openperipheral_sensor_34={z=279,y=199,x=8,},openperipheral_sensor_7={z=257,y=199,x=-25,},openperipheral_sensor_76={z=323,y=199,x=-47,},openperipheral_sensor_104={z=345,y=199,x=8,},openperipheral_sensor_130={z=367,y=199,x=30,},openperipheral_sensor_140={z=378,y=199,x=8,},openperipheral_sensor_86={z=323,y=199,x=74,},openperipheral_sensor_52={z=290,y=199,x=74,},openperipheral_sensor_83={z=323,y=199,x=41,},openperipheral_sensor_6={z=257,y=199,x=-36,},openperipheral_sensor_103={z=345,y=199,x=-3,},openperipheral_sensor_82={z=323,y=199,x=30,},openperipheral_sensor_47={z=290,y=199,x=19,},openperipheral_sensor_144={z=378,y=199,x=52,},openperipheral_sensor_80={z=323,y=199,x=-3,},openperipheral_sensor_88={z=334,y=199,x=-36,},openperipheral_sensor_118={z=356,y=199,x=30,},openperipheral_sensor_124={z=367,y=199,x=-36,},openperipheral_sensor_125={z=367,y=199,x=-25,},openperipheral_sensor_21={z=268,y=199,x=-3,},openperipheral_sensor_122={z=356,y=199,x=74,},openperipheral_sensor_126={z=367,y=199,x=-14,},openperipheral_sensor_108={z=345,y=199,x=52,},openperipheral_sensor_31={z=279,y=199,x=-25,},openperipheral_sensor_133={z=367,y=199,x=63,},openperipheral_sensor_79={z=323,y=199,x=-14,},openperipheral_sensor_49={z=290,y=199,x=41,},openperipheral_sensor_95={z=334,y=199,x=41,},openperipheral_sensor_143={z=378,y=199,x=41,},openperipheral_sensor_15={z=257,y=199,x=63,},openperipheral_sensor_4={z=301,y=199,x=-14,},openperipheral_sensor_10={z=257,y=199,x=8,},openperipheral_sensor_101={z=345,y=199,x=-25,},openperipheral_sensor_97={z=334,y=199,x=63,},openperipheral_sensor_27={z=268,y=199,x=63,},openperipheral_sensor_39={z=279,y=199,x=63,},openperipheral_sensor_32={z=279,y=199,x=-14,},openperipheral_sensor_123={z=367,y=199,x=-47,},openperipheral_sensor_5={z=257,y=199,x=-47,},openperipheral_sensor_87={z=334,y=199,x=-47,},openperipheral_sensor_102={z=345,y=199,x=-14,},openperipheral_sensor_68={z=312,y=199,x=-3,},openperipheral_sensor_138={z=378,y=199,x=-14,},openperipheral_sensor_14={z=257,y=199,x=52,},openperipheral_sensor_70={z=312,y=199,x=19,},openperipheral_sensor_93={z=334,y=199,x=19,},openperipheral_sensor_117={z=356,y=199,x=19,},openperipheral_sensor_128={z=367,y=199,x=8,},openperipheral_sensor_44={z=290,y=199,x=-14,},openperipheral_sensor_12={z=257,y=199,x=30,},openperipheral_sensor_81={z=323,y=199,x=8,},openperipheral_sensor_41={z=290,y=199,x=-47,},openperipheral_sensor_66={z=312,y=199,x=-25,},openperipheral_sensor_100={z=345,y=199,x=-36,},openperipheral_sensor_63={z=301,y=199,x=74,},openperipheral_sensor_55={z=301,y=199,x=-25,},openperipheral_sensor_213={z=378,y=199,x=-25,},openperipheral_sensor_51={z=290,y=199,x=63,},openperipheral_sensor_146={z=378,y=199,x=63,},openperipheral_sensor_139={z=378,y=199,x=-3,},openperipheral_sensor_57={z=301,y=199,x=8,},openperipheral_sensor_16={z=257,y=199,x=74,},openperipheral_sensor_106={z=345,y=199,x=30,},openperipheral_sensor_22={z=268,y=199,x=8,},openperipheral_sensor_142={z=378,y=199,x=30,},openperipheral_sensor_11={z=257,y=199,x=19,},openperipheral_sensor_72={z=312,y=199,x=41,},openperipheral_sensor_115={z=356,y=199,x=-3,},openperipheral_sensor_109={z=345,y=199,x=63,},openperipheral_sensor_119={z=356,y=199,x=41,},openperipheral_sensor_129={z=367,y=199,x=19,},openperipheral_sensor_78={z=323,y=199,x=-25,},openperipheral_sensor_92={z=334,y=199,x=8,},openperipheral_sensor_8={z=257,y=199,x=-14,},openperipheral_sensor_84={z=323,y=199,x=52,},openperipheral_sensor_89={z=334,y=199,x=-25,},openperipheral_sensor_19={z=268,y=199,x=-25,},openperipheral_sensor_65={z=312,y=199,x=-36,},openperipheral_sensor_17={z=268,y=199,x=-47,},openperipheral_sensor_54={z=301,y=199,x=-36,},openperipheral_sensor_53={z=301,y=199,x=-47,},openperipheral_sensor_46={z=290,y=199,x=8,},openperipheral_sensor_33={z=279,y=199,x=-3,},openperipheral_sensor_59={z=301,y=199,x=30,},openperipheral_sensor_56={z=301,y=199,x=-3,},openperipheral_sensor_50={z=290,y=199,x=52,},openperipheral_sensor_112={z=356,y=199,x=-36,},openperipheral_sensor_113={z=356,y=199,x=-25,},openperipheral_sensor_36={z=279,y=199,x=30,},openperipheral_sensor_131={z=367,y=199,x=41,},openperipheral_sensor_132={z=367,y=199,x=52,},openperipheral_sensor_62={z=301,y=199,x=63,},openperipheral_sensor_29={z=279,y=199,x=-47,},openperipheral_sensor_30={z=279,y=199,x=-36,},openperipheral_sensor_35={z=279,y=199,x=19,},openperipheral_sensor_69={z=312,y=199,x=8,},openperipheral_sensor_64={z=312,y=199,x=-47,},openperipheral_sensor_135={z=378,y=199,x=-47,},openperipheral_sensor_107={z=345,y=199,x=41,},openperipheral_sensor_73={z=312,y=199,x=52,},openperipheral_sensor_13={z=257,y=199,x=41,},openperipheral_sensor_114={z=356,y=199,x=-14,},openperipheral_sensor_105={z=345,y=199,x=19,},openperipheral_sensor_121={z=356,y=199,x=63,},openperipheral_sensor_99={z=345,y=199,x=-47,},openperipheral_sensor_38={z=279,y=199,x=52,},openperipheral_sensor_136={z=378,y=199,x=-36,},openperipheral_sensor_94={z=334,y=199,x=30,},openperipheral_sensor_60={z=301,y=199,x=41,},openperipheral_sensor_20={z=268,y=199,x=-14,},}
  2. x0=47
  3. z0=-256
  4.  
  5. function wrapPs(peripheralName)
  6. periTab={}
  7. sideTab={}
  8. if peripheralName==nil then
  9. print("Fehler")
  10. end
  11. local peripherals = peripheral.getNames()
  12. local i2 = 1
  13. for i =1, #peripherals do
  14. if peripheral.getType(peripherals[i])==peripheralName then
  15. periTab[i2]=peripheral.wrap(peripherals[i])
  16. sideTab[i2]=peripherals[i]
  17. i2=i2+1
  18. end
  19. end
  20. if periTab~={} then
  21. return periTab,sideTab
  22. else
  23. return nil
  24. end
  25. end
  26.  
  27. s=wrapPs("openperipheral_sensor")
  28. t=wrapPs("openperipheral_bridge")[1]
  29.  
  30. function scan(s,mode)
  31. if mode==nil then
  32. mode="all"
  33. end
  34.  
  35. if mode=="mob" or mode=="all" then
  36. mobs=s.getEntityIds("mob")
  37. for i=1, #mobs do
  38. data=nil
  39. data=s.getEntityData(mobs[i],"mob")
  40. if data~=nil then
  41. entity.mob[#entity.mob+1]=data.all()
  42. else
  43. entity.mob[#entity.mob+1]="lost"
  44. end
  45. end
  46. end
  47.  
  48. if mode=="item" or mode=="all" then
  49. items=s.getEntityIds("item")
  50. for i=1, #items do
  51. data=nil
  52. data=s.getEntityData(items[i],"item")
  53. if data~=nil then
  54. entity.item[#entity.item+1]=data.all()
  55. else
  56. entity.item[#entity.item+1]="lost"
  57. end
  58. end
  59. end
  60.  
  61. if mode=="player" or mode=="all" then
  62. players=s.getPlayers()
  63. for i=1, #players do
  64. data=nil
  65. data=s.getPlayerByName(players[i].name)
  66. if data~=nil then
  67. entity.player[#entity.player+1]=data.all()
  68. inv=entity.player[#entity.player].player.inventory
  69. for i2=1, 40 do
  70. if inv[i2]~=nil then
  71. fp=fs.open("temp","w")
  72. itemp=#entity.player
  73. i2temp=i2
  74. error=true
  75. fp.write("entity.player[itemp].player.inventory[i2temp]=inv[i2temp].all() error=false")
  76. fp.close()
  77. shell.run("temp")
  78. shell.run("rm temp")
  79. if error then
  80. entity.player[itemp].player.inventory[i2temp]=nil
  81. end
  82. end
  83. end
  84. else
  85. entity.player[#entity.player+1]="lost"
  86. end
  87. end
  88. end
  89.  
  90. if mode=="minecart" or mode=="all" then
  91. minecarts=s.getEntityIds("minecart")
  92. for i=1, #minecarts do
  93. data=nil
  94. data=s.getEntityData(minecarts[i],"minecart")
  95. if data~=nil then
  96. entity.minecart[#entity.minecart+1]=data.all()
  97. else
  98. entity.minecart[#entity.minecart+1]="lost"
  99. end
  100. end
  101. end
  102.  
  103. if mode=="frame" or mode=="all" then
  104. itemFrames=s.getEntityIds("item_frame")
  105. for i=1, #itemFrames do
  106. data=nil
  107. data=s.getEntityData(itemFrames[i],"item_frame")
  108. if data~=nil then
  109. entity.itemFrame[#entity.itemFrame+1]=data.all()
  110. else
  111. entity.itemFrame[#entity.itemFrame+1]="lost"
  112. end
  113. end
  114. end
  115.  
  116. return entity
  117. end
  118.  
  119. function string.cut(txt,char)
  120. while string.find(txt,char) do
  121. txt=string.sub(txt,1,string.find(txt,char)-1)..string.sub(txt,string.find(txt,char)+1,#txt)
  122. end
  123. return txt
  124. end
  125.  
  126.  
  127. function format(txt)
  128. txt=string.cut(txt,'\n')
  129. txt=string.cut(txt,'\r')
  130. txt=string.cut(txt,'\t')
  131. txt=string.cut(txt," ")
  132. txt=string.sub(txt,1,4000)
  133. return txt
  134. end
  135.  
  136. function scanAll(mode)
  137.     s=wrapPs("openperipheral_sensor")
  138.     entity={}
  139.     entity.item={}
  140.     entity.mob={}
  141.     entity.player={}
  142.     entity.minecart={}
  143.     entity.itemFrame={}
  144.         for i42=1,#s do
  145.             scan(s[i42],mode)
  146.  
  147.             term.clear()
  148.             term.setCursorPos(1,1)
  149.             term.write(math.floor(100/#s*i42).."%")
  150.         end
  151. end
  152.  
  153. function scanPos(mode)
  154.     entity={}
  155.     entity.item={}
  156.     entity.mob={}
  157.     entity.player={}
  158.     entity.minecart={}
  159.     entity.itemFrame={}
  160.     el=1
  161.     ePos={}
  162.     eName={}
  163.     s,ss=wrapPs("openperipheral_sensor")
  164.         for i42=1,#s do
  165.             scan(s[i42],mode)
  166.  
  167.                 for i=1,#entity.mob do
  168.                     ePos[format(entity.mob[i].name)..entity.mob[i].id]={x=coords[ss[i42]].x+entity.mob[i].position.x,y=coords[ss[i42]].y+entity.mob[i].position.y,z=coords[ss[i42]].z+entity.mob[i].position.z}
  169.                     eName[el]=format(entity.mob[i].name)..entity.mob[i].id
  170.                     el=el+1
  171.                 end
  172.                 for i=1,#entity.player do
  173.                     ePos[format(entity.player[i].name)..entity.player[i].id]={x=coords[ss[i42]].x+entity.player[i].position.x,y=coords[ss[i42]].y+entity.player[i].position.y,z=coords[ss[i42]].z+entity.player[i].position.z}
  174.                     eName[el]=format(entity.player[i].name)..entity.player[i].id
  175.                     el=el+1
  176.                 end
  177.             entity={}
  178.     entity.item={}
  179.     entity.mob={}
  180.     entity.player={}
  181.     entity.minecart={}
  182.     entity.itemFrame={}
  183.         term.clear()
  184.         term.setCursorPos(1,1)
  185.         term.write(i42.."/"..#s)
  186.         end
  187. end
  188.  
  189. function shootAt(target, shots)
  190. if shots==nil then shots=1 end
  191. target=ePos[target]
  192. c,cs=wrapPs("airCannon")
  193.     for i=1, #c do
  194.     success=c[i].setTargetLocation(target.x,target.y,target.z)
  195.         if success then
  196.             for i2=1,shots do
  197.                 c[i].fire()
  198.                 sleep(0.2)
  199.             end
  200.         end
  201.     end
  202. end
  203.  
  204. function shootAtPos(target, shots)
  205. if shots==nil then shots=1 end
  206. c,cs=wrapPs("airCannon")
  207.     for i=1, #c do
  208.     success=c[i].setTargetLocation(target[1],target[2],target[3])
  209.         if success then
  210.             for i2=1,shots do
  211.                 c[i].fire()
  212.                 sleep(0.2)
  213.             end
  214.         end
  215.     end
  216. end
  217.  
  218.  
  219. function findAndShoot(target, shots)
  220.     for i=1, #eName do
  221.         if string.find(eName[i],target)~=nil then
  222.             shootAt(eName[i],shots)
  223.         end
  224.     end
  225. end
  226.  
  227. function autoShoot(target, shots)
  228. alive=true
  229.     while alive do
  230.         alive=false
  231.         scanPos("mob")
  232.         for i=1, #eName do
  233.             if string.find(eName[i],target)~=nil then
  234.                 alive=true
  235.                 shootAt(eName[i],shots)
  236.             end
  237.         end
  238.     end
  239. end
  240.  
  241. function shootArea(target, radius, shots)
  242. if shots==nil then shots=1 end
  243. c,cs=wrapPs("airCannon")
  244.     for i=1, #eName do
  245.         if string.find(eName[i],target)~=nil then
  246.         targetPos=ePos[eName[i]]
  247.             for i2=1,shots do
  248.                 for x=-radius, radius do
  249.                     for y=-radius, radius do
  250.                         for n=1, #c do         
  251.                             success=c[n].setTargetLocation(targetPos.x+x,targetPos.y+y,targetPos.z)
  252.                             if success then
  253.                                 c[n].fire()
  254.                                 sleep(0.2)
  255.                             end
  256.                         end
  257.                     end
  258.                 end
  259.             end
  260.         end
  261.     end
  262. end
  263.  
  264. function showInventory(playerName)
  265. t.clear()
  266.     for i=1, #entity.player do
  267.         if entity.player[i].name==playerName then
  268.             y=1
  269.             x=1
  270.             i1=1
  271.             while i1<=40 do
  272.                 while x<=180 do
  273.                     if entity.player[i].player.inventory[i1]~=nil then
  274.                         t.addIcon(x,y,entity.player[i].player.inventory[i1].id)
  275.                         if entity.player[i].player.inventory[i1].qty>1 then
  276.                             t.addText(x,y+10,tostring(entity.player[i].player.inventory[i1].qty),0)
  277.                         end
  278.                     end
  279.                     print(i1)
  280.                     i1=i1+1
  281.                     x=x+20
  282.                 end
  283.                 x=1
  284.                 y=y+20
  285.             end
  286.         end
  287.     end
  288. t.sync()
  289. end
  290.  
  291. function showMap(mode)
  292. t.clear()
  293. scanPos(mode)
  294.     for i=1, #eName do
  295.         pos=ePos[eName[i]]
  296.         t.addText((pos.x-x0),(pos.z-z0),eName[i],0)
  297.     end
  298. t.sync()
  299. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement