-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathraw-svo.inker.lua
385 lines (363 loc) · 7.17 KB
/
raw-svo.inker.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
-- Svof (c) 2011-2015 by Vadim Peretokin
-- Svof is licensed under a
-- Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
-- You should have received a copy of the license along with this
-- work. If not, see <http://creativecommons.org/licenses/by-nc-sa/4.0/>.
ti_version = "1.1"
local limb_order = {"head", "torso", "right arm", "left arm", "right leg", "left leg", "back"}
local tattoos = {
ox = {
{
1,
"goldink",
},
{
1,
"redink",
},
{
1,
"yellowink",
},
{
1,
"blueink",
}
},
cloak = {
{
3,
"blueink",
}
},
firefly = {
{
1,
"yellowink",
}
},
bell = {
{
3,
"blueink",
},
{
2,
"redink",
}
},
moss = {
{
1,
"blueink",
},
{
1,
"redink",
},
{
1,
"yellowink",
}
},
prism = {
{
1,
"blueink",
},
{
1,
"greenink",
},
{
1,
"purpleink",
},
{
1,
"redink",
},
{
1,
"yellowink",
}
},
mindseye = {
{
2,
"blueink",
},
{
1,
"greenink",
}
},
brazier = {
{
2,
"redink",
},
{
2,
"yellowink",
}
},
feather = {
{
2,
"blueink",
},
{
1,
"redink",
}
},
moon = {
{
1,
"blueink",
},
{
1,
"redink",
},
{
1,
"yellowink",
}
},
starburst = {
{
1,
"blueink",
},
{
1,
"goldink",
},
{
1,
"greenink",
},
{
1,
"purpleink",
},
{
1,
"redink",
},
{
1,
"yellowink",
}
},
chameleon = {
{
1,
"goldink",
},
{
1,
"purpleink",
},
{
1,
"yellowink",
}
},
crystal = {
{
1,
"greenink",
},
{
1,
"purpleink",
},
{
1,
"yellowink",
}
},
megalith = {
{
2,
"goldink",
}
},
tree = {
{
5,
"greenink",
}
},
hourglass = {
{
1,
"blueink",
},
{
2,
"yellowink",
}
},
hammer = {
{
1,
"purpleink",
},
{
2,
"redink",
}
},
tentacle = {
{
2,
"greenink",
},
{
1,
"purpleink",
}
},
web = {
{
1,
"greenink",
},
{
1,
"yellowink",
}
},
boar = {
{
1,
"purpleink",
},
{
2,
"redink",
}
},
shield = {
{
1,
"greenink",
},
{
2,
"redink",
}
}
}
svo.ti_inking = false
-- if ends with 'on person', then it's on a person!
function svo.ti_ink(order)
local anotherperson = order:match(" on (%w+)$")
if anotherperson then order = order:sub(1, #order-#anotherperson-4) end
local tattoos = string.split(order, ",")
for i = 1, #tattoos do tattoos[i] = string.trim(tattoos[i]) end
svo.ti_inking = {on = anotherperson or "me", tattoos = tattoos, ink_counter = 1, tattoo_counter = 1}
svo.echof("Going to ink %s on %s.", concatand(ti_inking.tattoos), svo.ti_inking.on)
svo.showprompt() echo"\n"
svo.app("on")
svo.ti_inknext()
end
local function doneinking()
local touchables = {"moss", "moon", "boar", "megalith", "ox"}
local needtotouch = {}
for i = 1, svo.ti_inking.tattoo_counter do
if table.contains(touchables, svo.ti_inking.tattoos[i]) then needtotouch[#needtotouch+1] = svo.ti_inking.tattoos[i] end
end
if #needtotouch > 0 then
if svo.ti_inking.on ~= "me" then
if svo.conf.telltouch then send(string.format("say to %s you should now touch your %s tattoo%s", svo.ti_inking.on, concatand(needtotouch), (#needtotouch == 1 and "" or "s"))) end
end
end
svo.ti_inking = nil
echo("\n")
svo.app("off")
svo.echof("Finished inking all tattoos.")
end
function svo.ti_cantink(limb)
if not svo.ti_inking then return end
if limb == limb_order[#limb_order] then
echo("\n")
svo.echof("No more inking spots on %s :|", (svo.ti_inking.on == "me" and "you" or svo.ti_inking.on))
svo.showprompt()
doneinking()
else
svo.ti_inking.ink_counter = svo.ti_inking.ink_counter + 1
svo.ti_inknext()
end
end
function svo.ti_finishedinking()
if not ti_inking then return end
if table.contains({"moss", "moon", "boar", "megalith", "ox"}, svo.ti_inking.tattoos[svo.ti_inking.tattoo_counter]) then
send("touch "..svo.ti_inking.tattoos[svo.ti_inking.tattoo_counter])
end
svo.ti_inking.tattoo_counter = svo.ti_inking.tattoo_counter + 1
if not svo.ti_inking.tattoos[svo.ti_inking.tattoo_counter] then
doneinking()
else
svo.ti_inking.ink_counter = 1
echo("\n")
svo.echof("Inking the next tattoo...")
svo.ti_inknext()
end
end
function svo.ti_inknext()
if svo.ti_inking.ink_counter == 1 and not tattoos[svo.ti_inking.tattoos[svo.ti_inking.tattoo_counter]] then
svo.echof("Don't know the inks necessary for a %s tattoo.", svo.ti_inking.tattoos[svo.ti_inking.tattoo_counter])
svo.showprompt()
elseif svo.ti_inking.ink_counter == 1 then
for _, t in pairs(tattoos[svo.ti_inking.tattoos[svo.ti_inking.tattoo_counter]]) do
sendc(string.format("outr %d %s", t[1], t[2]), false)
end
end
sendc(string.format("ink %s on %s of %s", svo.ti_inking.tattoos[svo.ti_inking.tattoo_counter], limb_order[svo.ti_inking.ink_counter], svo.ti_inking.on))
end
function svo.ti_interrupted()
if not svo.ti_inking then return end
svo.ti_inking.ink_counter = 1
if svo.ti_inking.on == "me" then
echo"\n" svo.echof("Be still! Going to ink again in a few...")
else
send(string.format("say to %s be still!", svo.ti_inking.on))
end
tempTimer(2, function() svo.ti_inknext() end)
end
function svo.ti_noinks()
echo("\n") svo.echof("Lacking inks for the %s tattoo...", svo.ti_inking.tattoos[svo.ti_inking.tattoo_counter])
if not svo.ti_inking.tattoos[svo.ti_inking.tattoo_counter + 1] then
doneinking()
else
svo.ti_inking.tattoo_counter = svo.ti_inking.tattoo_counter + 1
svo.ti_inknext()
end
end
config.setoption("telltouch",
{
type = "boolean",
vconfig2string = true,
onshow = function (defaultcolour)
fg("gold")
echoLink("ti:", "", "svo Tattoo Inker", true)
-- <Tell/Don't tell> people to touch inked tattoos
if svo.conf.telltouch then
fg("a_cyan") echoLink(" Will tell", "svo.config.set('telltouch', false, true)", "Click to stop telling people to touch their newly-inked tattoos", true)
else
fg("a_cyan") echoLink(" Won't tell", "svo.config.set('telltouch', true, true)", "Click to start telling people to touch their newly-inked tattoos", true)
end
fg(defaultcolour) echo(" people to touch inked tattoos")
echo(".\n")
end,
onenabled = function ()
echof("<0,250,0>Will%s tell people to touch tattoos they need to after inking.", getDefaultColor())
end,
ondisabled = function () echof("<250,0,0>Won't%s tell people to touch tattoos they need to after inking.", getDefaultColor()) end
})
echof("Loaded svo Tattoo Inker, version %s.", tostring(ti_version))