-
Notifications
You must be signed in to change notification settings - Fork 0
/
global.yue
182 lines (175 loc) · 2.72 KB
/
global.yue
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
173
174
175
176
177
178
179
180
181
182
global *
inspect = require'inspect'
sleep = require'time.sleep'
terminal = require'BearLibTerminal'
clock = require'clock'
signal = require'signal'
assert = (pass, ...) ->
return pass, ... if pass
error concat({...}), 2 if select('#', ...) > 0
error 'assertion failed!', 2
isstring = (data) -> type(data) == 'string'
isnumber = (data) -> type(data) == 'number'
isfunction = (data) -> type(data) == 'function'
STATES =
PLAYERS_TURN: 1
ENEMY_TURN: 2
PLAYER_DEAD: 3
SHOW_INVENTORY: 4
DROP_INVENTORY: 5
TARGETING: 6
LEVEL_UP: 7
CHAR_SCREEN: 8
DIRS =
FOUR: {
{ 0,-1}
{ 1, 0}
{ 0, 1}
{-1, 0}
}
EIGHT: {
{ 0,-1},
{ 1,-1},
{ 1, 0},
{ 1, 1},
{ 0, 1},
{-1, 1},
{-1, 0},
{-1,-1}
}
OPAQUE = -1
TRANSPARENT = 1
TK_0 = 39
TK_1 = 30
TK_2 = 31
TK_3 = 32
TK_4 = 33
TK_5 = 34
TK_6 = 35
TK_7 = 36
TK_8 = 37
TK_9 = 38
TK_A = 4
TK_ALIGN_BOTTOM = 8
TK_ALIGN_CENTER = 3
TK_ALIGN_DEFAULT = 0
TK_ALIGN_LEFT = 1
TK_ALIGN_MIDDLE = 12
TK_ALIGN_RIGHT = 2
TK_ALIGN_TOP = 4
TK_ALT = 114
TK_APOSTROPHE = 52
TK_B = 5
TK_BACKSLASH = 49
TK_BACKSPACE = 42
TK_BKCOLOR = 197
TK_C = 6
TK_CELL_HEIGHT = 195
TK_CELL_WIDTH = 194
TK_CHAR = 200
TK_CLOSE = 224
TK_COLOR = 196
TK_COMMA = 54
TK_COMPOSITION = 199
TK_CONTROL = 113
TK_D = 7
TK_DELETE = 76
TK_DOWN = 81
TK_E = 8
TK_END = 77
TK_ENTER = 40
TK_EQUALS = 46
TK_ESCAPE = 41
TK_EVENT = 202
TK_F = 9
TK_F1 = 58
TK_F10 = 67
TK_F11 = 68
TK_F12 = 69
TK_F2 = 59
TK_F3 = 60
TK_F4 = 61
TK_F5 = 62
TK_F6 = 63
TK_F7 = 64
TK_F8 = 65
TK_F9 = 66
TK_FULLSCREEN = 203
TK_G = 10
TK_GRAVE = 53
TK_H = 11
TK_HEIGHT = 193
TK_HOME = 74
TK_I = 12
TK_INPUT_CANCELLED = -1
TK_INPUT_NONE = 0
TK_INSERT = 73
TK_J = 13
TK_K = 14
TK_KEY_RELEASED = 256
TK_KP_0 = 98
TK_KP_1 = 89
TK_KP_2 = 90
TK_KP_3 = 91
TK_KP_4 = 92
TK_KP_5 = 93
TK_KP_6 = 94
TK_KP_7 = 95
TK_KP_8 = 96
TK_KP_9 = 97
TK_KP_DIVIDE = 84
TK_KP_ENTER = 88
TK_KP_MINUS = 86
TK_KP_MULTIPLY = 85
TK_KP_PERIOD = 99
TK_KP_PLUS = 87
TK_L = 15
TK_LAYER = 198
TK_LBRACKET = 47
TK_LEFT = 80
TK_M = 16
TK_MINUS = 45
TK_MOUSE_CLICKS = 140
TK_MOUSE_LEFT = 128
TK_MOUSE_MIDDLE = 130
TK_MOUSE_MOVE = 133
TK_MOUSE_PIXEL_X = 137
TK_MOUSE_PIXEL_Y = 138
TK_MOUSE_RIGHT = 129
TK_MOUSE_SCROLL = 134
TK_MOUSE_WHEEL = 139
TK_MOUSE_X = 135
TK_MOUSE_X1 = 131
TK_MOUSE_X2 = 132
TK_MOUSE_Y = 136
TK_N = 17
TK_O = 18
TK_OFF = 0
TK_ON = 1
TK_P = 19
TK_PAGEDOWN = 78
TK_PAGEUP = 75
TK_PAUSE = 72
TK_PERIOD = 55
TK_Q = 20
TK_R = 21
TK_RBRACKET = 48
TK_RESIZED = 225
TK_RETURN = 40
TK_RIGHT = 79
TK_S = 22
TK_SEMICOLON = 51
TK_SHIFT = 112
TK_SLASH = 56
TK_SPACE = 44
TK_T = 23
TK_TAB = 43
TK_U = 24
TK_UP = 82
TK_V = 25
TK_W = 26
TK_WCHAR = 201
TK_WIDTH = 192
TK_X = 27
TK_Y = 28
TK_Z = 29