diff options
Diffstat (limited to 'shop2/main.lua')
-rw-r--r-- | shop2/main.lua | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/shop2/main.lua b/shop2/main.lua index 322d76c..67d3dba 100644 --- a/shop2/main.lua +++ b/shop2/main.lua @@ -3,18 +3,10 @@ package.path = "/?;/?.lua;"..package.path local key=assert(settings.get"krist.pkey","please set private key") local stock=require"shop2.stock" - +local items = require"shop2.items" -- ac.kst local OURNAME = "ac" -local ITEMS = {} -local function i(adr,itname,hname,price) - ITEMS[adr]={itname=itname,hname=hname,price=price,adr=adr} -end -i("dmn","minecraft:diamond","Diamond",5) -i("blz","minecraft:blaze_rod","Blaze Rod",10) -i("ely","minecraft:elytra","Elytra",200) - local sres =textutils.unserializeJSON( http.post("https://krist.dev/ws/start","privatekey="..key).readAll()) assert(sres.ok,"not ok") @@ -53,7 +45,7 @@ local function proctrans(tr) local function refund() if meta['return'] then sendws { type="make_transaction", to=meta['return'], amount=tr.value } end end local mtn = tr.sent_metaname - local idesc = ITEMS[mtn] + local idesc = items[mtn] if not idesc then -- some other metaname that has nothing to do with us -- presumably some other service @ac.kst. so just ignore it @@ -85,10 +77,8 @@ local function proctrans(tr) end local function run_shop() - print("RUNSHOP") while true do local msgtxt = assert(ws.receive(),"ws error") - print(msgtxt) local msg = textutils.unserializeJSON(msgtxt) if msg.type == "response" and msg.responding_to_type == "me" then our_addr = msg.address.address |