summaryrefslogtreecommitdiff
path: root/shop2.lua
blob: ea6f5225df6f0c4cbbcfce321432baf60b3fbd08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
local ourname = "ac.kst"

local ITEMS = {
	{"dmn",  5, "minecraft:diamond"},
	{"blz", 10, "minecraft:blaze_rod"},
	{"ely", 40, "minecraft:elytra"},
}

local function printseq(m) return function(q)
	for _,v in ipairs(q) do
		if type(v) == "number" then
			m.setTextColor(v)
		elseif type(v) == "string" then
			m.write(v)
		elseif type(v) == "table" then
			if #v == 2 then
				-- position
				m.setCursorPos(v[1],v[2])
			else
				error("unknown format")
			end
		end
	end
end end


local function disp_shopscreen()
	local m = peripheral.wrap"left"
	m.clear()
	m.setTextScale(1)
	-- Stock  Price     Adr.   Name
	-- xxxxx  xxxxxkst  dmn    Diamond
	-- 123456789012345678901234567890123456789012345678901234567
	-- 0        1         2         3         4         5
	printseq(m) {
		{1,1}, colors.orange, "Apionics Consortium Store",
		{1,2}, colors.lightgray, "Stock  Price     Adr.   Name",
		{1,3}, colors.white, "  321",
		{8,3}, colors.yellow, "    5", colors.lightgray, "kst",
		{18,3}, colors.cyan, "dmn",
		{25,3}, colors.white, "Diamond",
	}

		
end

disp_shopscreen()