Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local XP = peripheral.wrap("left")
- local Anvil= peripheral.wrap("right")
- local hora,nivel
- XP.setAutoCollect(true)
- local function UI()
- hora = os.time()
- term.clear()
- term.setCursorPos(31,1)
- print(textutils.formatTime(hora))
- term.setCursorPos(1,3)
- nivel = XP.getLevels()
- print("\tTengo "..nivel.." niveles de experiencia.")
- term.setCursorPos(1,5)
- print("\tUsar Slot1 y Slot 2 para reparar objetos.")
- print("\tUsar Slot1 para encantar.")
- print("\n\t\t1. Encantar")
- print("\t\t2. Reparar")
- os.startTimer(1)
- end
- local function canRepair()
- term.clear()
- if nivel < 1 then
- return
- end
- local cost = Anvil.getRepairCost(1,2)
- if cost > 0 then
- term.setCursorPos(4,6)
- print("Reparar este objeto costar�A1 "..tostring(cost)..". �BFContinuar? S/N")
- local input = read()
- if input=="S" then
- Anvil.repair(1,2)
- end
- else
- print("No se puede reparar . . .");
- sleep(1)
- end
- os.startTimer(1)
- end
- local function tryEnchant()
- if nivel < 1 then
- return
- end
- if turtle.getItemCount(1) < 0 then
- return
- end
- term.clear()
- term.setCursorPos(1,3)
- print("\t\t�BFCuantos niveles usar (1-30)?")
- input = 0
- while tonumber(input) < 1 or tonumber(input) > 30 do
- local input = read()
- print(input)
- if XP.enchant(tonumber(input)) then
- print("Se ha encantado el objeto")
- break;
- else
- print("No se ha podido hacer el encantamiento")
- end
- end
- sleep(1)
- os.startTimer(1)
- end
- local a,b,c,d
- UI()
- while true do
- a,b,c,d = os.pullEvent()
- if a=="timer" then
- UI()
- elseif a=="key" and b==2 then
- tryEnchant()
- --XP.setAutoCollect(true)
- elseif a=="key" and b==3 then
- canRepair()
- --XP.setAutoCollect(true)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment