summaryrefslogtreecommitdiff
path: root/doc/api.md
blob: 012d882e529030396bf11b227f805c7e356a32bd (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Digiline interface

## get shop status



```lua
digiline_send('channel', {
        type='get'
    }
)
```

response from shop looks like this:

```lua
{
		offer = {
                {
                        give_count = 4,
                        pay_count = 3,
                        pay = "basenodes:cobble",
                        stock = 0,
                        give = "basenodes:dirt",
                        pay_price = 0
                },
                {
                        give_count = 25,
                        pay_count = 1,
                        pay = "currency:minegeld_10",
                        stock = 1,
                        give = "digilines:lcd",
                        pay_price = 0.4
                },
                {
                        give_count = 12,
                        pay_count = 3,
                        pay = "currency:minegeld_10",
                        stock = 4,
                        give = "digilines:lcd",
                        pay_price = 2.5
                },
                {
                        give_count = 9,
                        pay_count = 3,
                        pay = "currency:minegeld_10",
                        stock = 5,
                        give = "digilines:lcd",
                        pay_price = 3.3333333333333
                }
        },
        inventory = {
                {
                        meta = {

                        },
                        metadata = "",
                        count = 25,
                        name = "digilines:lcd",
                        wear = 0
                },
                [5] = {
                        meta = {

                        },
                        metadata = "",
                        count = 3,
                        name = "currency:minegeld_10",
                        wear = 0
                },
                [28] = {
                        meta = {
                                palette_index = "0"
                        },
                        metadata = "",
                        count = 1,
                        name = "testnodes:mesh_colorwallmounted",
                        wear = 0
                }
        }
}
```



## set shop offer

following program will set third slot of offer, then this slot will receive three cobble for four dirt

```lua
digiline_send('channel', {
        type='set',
        offer={
            [3] = {give="basenodes:dirt",give_count=4,pay="basenodes:cobble",pay_count=3}
        }
    }
)
```