-
Notifications
You must be signed in to change notification settings - Fork 13
/
forms.lua
172 lines (157 loc) · 7.59 KB
/
forms.lua
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
function atm.showform (player)
atm.ensure_init(player:get_player_name())
local formspec =
"size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"label[1.25,0.5;Money input]" ..
"label[5.25,0.5;Money output]" ..
"label[2.5,0.15;Your account balance: $".. atm.balance[player:get_player_name()].. "]" ..
"button_exit[2.5,1.5;1,2;Quit;Quit]" ..
"item_image_button[0.5,1;1,1;".. "currency:minegeld" ..";i1;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[1.5,1;1,1;".. "currency:minegeld_5" ..";i5;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[2.5,1;1,1;".. "currency:minegeld_10" ..";i10;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[4.5,1;1,1;".. "currency:minegeld" ..";i-1;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[5.5,1;1,1;".. "currency:minegeld_5" ..";i-5;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[6.5,1;1,1;".. "currency:minegeld_10" ..";i-10;\n\n\b\b\b\b\b" .. "1" .."]" ..
"list[current_player;main;0,4.25;8,1;]"..
"list[current_player;main;0,5.5;8,3;8]"..
"listring[]"..
default.get_hotbar_bg(0, 4.25)
minetest.after((0.1), function(gui)
return minetest.show_formspec(player:get_player_name(), "atm.form", gui)
end, formspec)
end
function atm.showform2 (player)
atm.ensure_init(player:get_player_name())
local formspec =
"size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"label[1.25,0.5;Money input]" ..
"label[5.25,0.5;Money output]" ..
"label[2.5,0.15;Your account balance: $".. atm.balance[player:get_player_name()].. "]" ..
"button_exit[2.5,2.5;1,2;Quit;Quit]" ..
"item_image_button[0.5,1;1,1;".. "currency:minegeld" ..";i1;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[1.5,1;1,1;".. "currency:minegeld_5" ..";i5;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[2.5,1;1,1;".. "currency:minegeld_10" ..";i10;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[4.5,1;1,1;".. "currency:minegeld" ..";i-1;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[5.5,1;1,1;".. "currency:minegeld_5" ..";i-5;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[6.5,1;1,1;".. "currency:minegeld_10" ..";i-10;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[0.5,2;1,1;".. "currency:minegeld" ..";t10;\n\n\b\b\b\b\b" .. "10" .."]" ..
"item_image_button[1.5,2;1,1;".. "currency:minegeld_5" ..";t50;\n\n\b\b\b\b\b" .. "10" .."]" ..
"item_image_button[2.5,2;1,1;".. "currency:minegeld_10" ..";t100;\n\n\b\b\b\b\b" .. "10" .."]" ..
"item_image_button[4.5,2;1,1;".. "currency:minegeld" ..";t-10;\n\n\b\b\b\b\b" .. "10" .."]" ..
"item_image_button[5.5,2;1,1;".. "currency:minegeld_5" ..";t-50;\n\n\b\b\b\b\b" .. "10" .."]" ..
"item_image_button[6.5,2;1,1;".. "currency:minegeld_10" ..";t-100;\n\n\b\b\b\b\b" .. "10" .."]" ..
"list[current_player;main;0,4.25;8,1;]"..
"list[current_player;main;0,5.5;8,3;8]"..
"listring[]"..
default.get_hotbar_bg(0, 4.25)
minetest.after((0.1), function(gui)
return minetest.show_formspec(player:get_player_name(), "atm.form2", gui)
end, formspec)
end
function atm.showform3 (player)
atm.ensure_init(player:get_player_name())
local formspec =
"size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"label[1.25,0.5;Money input]" ..
"label[5.25,0.5;Money output]" ..
"label[2.5,0.15;Your account balance: $".. atm.balance[player:get_player_name()].. "]" ..
"button_exit[3.5,2.75;1,2;Quit;Quit]" ..
"item_image_button[0.5,1;1,1;".. "currency:minegeld" ..";i1;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[1.5,1;1,1;".. "currency:minegeld_5" ..";i5;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[2.5,1;1,1;".. "currency:minegeld_10" ..";i10;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[4.5,1;1,1;".. "currency:minegeld" ..";i-1;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[5.5,1;1,1;".. "currency:minegeld_5" ..";i-5;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[6.5,1;1,1;".. "currency:minegeld_10" ..";i-10;\n\n\b\b\b\b\b" .. "1" .."]" ..
"item_image_button[0.5,2;1,1;".. "currency:minegeld" ..";t10;\n\n\b\b\b\b\b" .. "10" .."]" ..
"item_image_button[1.5,2;1,1;".. "currency:minegeld_5" ..";t50;\n\n\b\b\b\b\b" .. "10" .."]" ..
"item_image_button[2.5,2;1,1;".. "currency:minegeld_10" ..";t100;\n\n\b\b\b\b\b" .. "10" .."]" ..
"item_image_button[4.5,2;1,1;".. "currency:minegeld" ..";t-10;\n\n\b\b\b\b\b" .. "10" .."]" ..
"item_image_button[5.5,2;1,1;".. "currency:minegeld_5" ..";t-50;\n\n\b\b\b\b\b" .. "10" .."]" ..
"item_image_button[6.5,2;1,1;".. "currency:minegeld_10" ..";t-100;\n\n\b\b\b\b\b" .. "10" .."]" ..
"item_image_button[0.5,3;1,1;".. "currency:minegeld" ..";c100;\n\n\b\b\b\b\b" .. "100" .."]" ..
"item_image_button[1.5,3;1,1;".. "currency:minegeld_5" ..";c500;\n\n\b\b\b\b\b" .. "100" .."]" ..
"item_image_button[2.5,3;1,1;".. "currency:minegeld_10" ..";c1000;\n\n\b\b\b\b\b" .. "100" .."]" ..
"item_image_button[4.5,3;1,1;".. "currency:minegeld" ..";c-100;\n\n\b\b\b\b\b" .. "100" .."]" ..
"item_image_button[5.5,3;1,1;".. "currency:minegeld_5" ..";c-500;\n\n\b\b\b\b\b" .. "100" .."]" ..
"item_image_button[6.5,3;1,1;".. "currency:minegeld_10" ..";c-1000;\n\n\b\b\b\b\b" .. "100" .."]" ..
"list[current_player;main;0,4.25;8,1;]"..
"list[current_player;main;0,5.5;8,3;8]"..
"listring[]"..
default.get_hotbar_bg(0, 4.25)
minetest.after((0.1), function(gui)
return minetest.show_formspec(player:get_player_name(), "atm.form3", gui)
end, formspec)
end
-- wire transfer interface
function atm.showform_wt (player)
atm.ensure_init(player:get_player_name())
local formspec =
"size[8,6]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"button[5.75,0;2,1;transactions;Transactions >]" ..
"label[2.5,0;Wire Transfer Terminal]" ..
"label[2,0.5;Your account balance: $".. atm.balance[player:get_player_name()].. "]" ..
"field[0.5,1.5;5,1;dstn;Recepient:;]"..
"field[6,1.5;2,1;amnt;Amount:;]"..
"field[0.5,3;7.5,1;desc;Description:;]"..
"button_exit[0.2,5;1,1;Quit;Quit]" ..
"button[4.7,5;3,1;pay;Complete the payment]"
minetest.after((0.1), function(gui)
return minetest.show_formspec(player:get_player_name(), "atm.form.wt", gui)
end, formspec)
end
function atm.showform_wtconf (player, dstn, amnt, desc)
atm.ensure_init(player:get_player_name())
local formspec =
"size[8,6]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"label[2.5,0;Wire Transfer Terminal]" ..
"label[2,0.5;Your account balance: $".. atm.balance[player:get_player_name()].. "]" ..
"label[2.5,1;TRANSACTION SUMMARY:]"..
"label[0.5,1.5;Recepient: " .. dstn .. "]"..
"label[0.5,2;Amount: " .. amnt .. "]"..
"label[0.5,2.5;Description: " .. desc .. "]"..
"button_exit[0.2,5;1,1;Quit;Quit]" ..
"button[4.7,5;3,1;cnfrm;Confirm transfer]"
minetest.after((0.1), function(gui)
return minetest.show_formspec(player:get_player_name(), "atm.form.wtc", gui)
end, formspec)
end
function atm.showform_wtlist (player, tlist)
atm.ensure_init(player:get_player_name())
local textlist = ''
if not tlist then
textlist = "no transactions registered\n"
else
for _, entry in ipairs(tlist) do
textlist = textlist .. entry.date .. " $" .. entry.sum .. " from " .. entry.from .. ": " .. entry.desc .. "\n"
end
end
local formspec =
"size[8,6]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"button[5.75,0;2,1;transfer;< Transfer money]" ..
"label[2.5,0;Wire Transfer Terminal]" ..
"label[2,0.5;Your account balance: $".. atm.balance[player:get_player_name()].. "]" ..
"textarea[0.5,1.25;7.5,4;hst;Transaction list;" .. textlist .. "]" ..
"button_exit[0.2,5;1,1;Quit;Quit]" ..
"button[4.7,5;3,1;clr;Clear transactions]"
minetest.after((0.1), function(gui)
return minetest.show_formspec(player:get_player_name(), "atm.form.wtl", gui)
end, formspec)
end