darkshadowslade

Modified xp shoppe

Jan 8th, 2021 (edited)
942
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.88 KB | None | 0 0
  1. --# Wojbie's Xp Shoppe
  2. --# Uses touchpoint api
  3. --# http://pastebin.com/cRTsaYaK
  4.  
  5. --# Uncomment next line to remove Op message spam
  6. --commands.exec("gamerule commandBlockOutput false")
  7.  
  8. local Shop={}
  9.  
  10. --# table.insert(Shop,{["name"]="Stone Brick",["price"]=1,["item"]="minecraft:stonebrick 64"})
  11. --#table.insert(Shop,{["name"]="Tin Gear",["price"]=5,["item"]="Railcraft:part.gear 1 3",}) --3 is damage value for basic tin gear
  12. --#table.insert(Shop,{["name"]="Tarma Root",["price"]=2,["item"]="arsmagica2:TarmaRoot 1"})
  13. --#table.insert(Shop,{["name"]="Stone Brick",["price"]=1,["item"]="minecraft:stonebrick 64"})
  14. --#table.insert(Shop,{["name"]="Stone",["price"]=100,["item"]="minecraft:stone 64"})
  15.  
  16.    
  17. table.insert(Shop,{["name"]="Diamond",["price"]=5,["item"]="minecraft:diamond 1"})
  18.  
  19. table.insert(Shop,{["name"]="Mycelium",["price"]=1,["item"]="minecraft:mycelium 64"})
  20. table.insert(Shop,{["name"]="Soul Sand",["price"]=1,["item"]="minecraft:soul_sand 64"})
  21. table.insert(Shop,{["name"]="Thunder Hoe",["price"]=10,["item"]="framland:thunderhoe 1"})
  22. table.insert(Shop,{["name"]="Dev Null",["price"]=1,["item"]="danknull:dank_null_6 1"})
  23. table.insert(Shop,{["name"]="Blaze rods",["price"]=5,["item"]="minecraft:blaze_rod 16"})
  24. table.insert(Shop,{["name"]="Nether wart",["price"]=5,["item"]="minecraft:nether_wart 1"})
  25. table.insert(Shop,{["name"]="Slime ball",["price"]=1,["item"]="minecraft:slime_ball 1"})
  26. table.insert(Shop,{["name"]="Ender Pearl",["price"]=5,["item"]="minecraft:ender_pearl 16"})
  27.  
  28. --# Default shop zone to CommandComputer coords
  29. local range = 5
  30.  
  31. --# Load touchpoint api
  32. if not fs.exists("/touchpoint") then shell.run("pastebin get pFHeia96 /touchpoint") end
  33. os.loadAPI("touchpoint")
  34.  
  35. --# Assuming that monitor is on top of commandComputer
  36. local t = touchpoint.new("top")
  37.  
  38. --# Commands Backup
  39. --# give @p[lm=10,x=-532,y=69,z=1084,r=3] Railcraft:part.gear 1 3
  40. --# xp -10L @p[lm=10,x=-532,y=69,z=1084,r=3]
  41.  
  42. local jump=false
  43.  
  44. print("Adding "..#Shop.." Items to shop")
  45.  
  46. for i,k in pairs(Shop) do
  47.     local name = k.name.." = "..k.price.."L"
  48.     print(name)
  49.  
  50.     t:add(name, function()
  51.         --wiadomosc nie masz xp
  52.         commands.exec("tellraw @p[l="..(k.price-1)..",r="..range.."] "..'["",{"text":"You don\'t have lvl for '..k.name..'","color":"red"}]')
  53.         commands.exec("playsound mob.villager.no @p[l="..(k.price-1)..",r="..range.."]")
  54.         --wiadomosc masz xp
  55.         commands.exec("tellraw @p[lm="..k.price..",r="..range.."] "..'["",{"text":"Sold '..k.name.." for "..k.price..' lvl","color":"green"}]')
  56.         commands.exec("playsound mob.villager.yes @p[lm="..k.price..",r="..range.."]")
  57.         commands.exec("give @p[lm="..k.price..",r="..range.."] "..k.item)
  58.         commands.exec("xp -"..k.price.."L @p[lm="..k.price..",r="..range.."]")
  59.         t:flash(name)
  60.     end , 3+25*(jump and 1 or 0), 2+2*math.floor((i-1)/2), 23+24*(jump and 1 or 0),2+2*math.floor((i-1)/2), colors.red, colors.lime)
  61.  
  62.     jump=not jump
  63. end
  64.  
  65. t:run()
Advertisement
Add Comment
Please, Sign In to add comment