CCCPaste

MonitorQuotazionMinerali

mon = peripheral.wrap("right")
mon.setTextScale(0.5)
uri = "http://luanet.rgbcraft.com/servlets/vendite/clinica"

while true do
    term.redirect(mon)
    function clear()
    term.clear()
    term.setCursorPos(1, 1)
    term.setBackgroundColour(colours.black)
    term.setTextColor( colors.white )
    end
    function link()
    term.setTextColour(colours.yellow)
    end
    function fineLink()
    term.setTextColour(colours.white)
    end
    function colore(sfumatura)
    term.setTextColour(sfumatura)
    end
    function fineColore()
    term.setTextColour(colours.orange)
    end
    function sfondo(sfumaturaSfondo)
    term.setBackgroundColour(sfumaturaSfondo)
    end
    function fineSfondo()
    term.setBackgroundColour(colours.black)
    end
    clear()
    colore(colours.black)
    sfondo(colours.yellow)
    print("QUOTAZIONI MINERALI E GEMME PREZIOSE             ")
    fineColore()
    fineSfondo()
    quotazioni = textutils.unserialize(http.get(uri.."/?richiesta=prezzario_lua").readAll())
    print("\n")
    colore(colors.black)
    sfondo(colours.orange)
    print("Nome                              Quotaz.        ")
    fineColore()
    fineSfondo()
    ypos = 6
    local i = 0
    for k,v in pairs(quotazioni) do
    if (i % 2 == 0) then
        colore(colors.yellow)
    else
        colore(colors.orange)
    end
        term.setCursorPos(1, ypos)
        term.write(v["nome"])
        term.setCursorPos(36, ypos)
        term.write(v["prezzo"])
        ypos = ypos + 1
        i = i + 1
    end
    colore(colours.yellow)
    term.setCursorPos(1, 18)
    fineColore()
    term.restore()
    sleep(120)
end