29
30
31
32
33
34
35
36
37
38
39
40
41
42
...
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
...
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
...
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
|
dye = { caption = 'Any Dye', cnitem = 'dye:black' };
bone = { caption = 'Any Bone', cnitem = 'bonemeal:bone' };
vessel = { caption = 'Any Bottle', cnitem = 'vessels:glass_bottle' };
flower = { caption = 'Any Flower', cnitem = 'flowers:rose' };
mushroom = { caption = 'Any Mushroom', cnitem = 'flowers:mushroom_brown' };
water_bucket = { caption = 'Water Bucket', cnitem = 'bucket:bucket_water' };
sorcery_ley_cable = { caption = 'Cable', cnitem = 'sorcery:cable_vidrium' };
};
}
sorcery.cookbook.constants = constants
local slot3x3 = {
{0,0}, {1,0}, {2,0};
{0,1}, {1,1}, {2,1};
................................................................................
desc = string.format("%s (%u)",desc,s:get_count())
end
return desc
end;
local bookadjs = { -- sets are in reverse order!
{'Celestial', 'Divine', 'Inspired', 'Heavenly';
'Mystic', 'Diabolic', 'Luminous', 'Forsaken'};
{'Dark', 'Perfected', 'Flawless', 'Unthinkable';
'Impossible', 'Worrisome', 'Unimpeachable'};
{'Splendid', 'Magnificent', 'Sublime', 'Grand';
'Beneficent', 'Mysterious', 'Peculiar', 'Eerie';
'Fulsome', 'Fearsome', 'Curious', 'Fascinating';
'Notorious', 'Infamous'};
}
local cache = {
populate_grindables = function(cache)
if not cache.grindables then
cache.grindables = {}
for k,v in pairs(minetest.registered_items) do
................................................................................
local rec = {}
local en = sorcery.data.enchants[name]
if not en then return nil end
en = en.recipe
for i,e in pairs(en) do
if e.lens then
rec[i] = 'sorcery:lens_' .. e.lens .. '_' .. e.gem
end
end
return rec
end;
props = function(name)
return sorcery.data.enchants[name].info or {}
end;
slots = {
{0.5,0};
{0,1}, {1,1}
};
title = function(name) return sorcery.data.enchants[name].name end;
outdesc = function(name,suffix)
local e = sorcery.data.enchants[name]
return sorcery.lib.ui.tooltip {
title = e.name;
desc = sorcery.lib.str.capitalize(e.desc);
color = sorcery.lib.color(e.tone):readable();
}
end;
};
-- spells = {
-- booksuf = 'Spellbook';
-- slots = {
-- {0,0}, {1,0};
................................................................................
end
end
end
local img, ot
if props.note then
local nx, ny, nw, nh
if notes_right then
nx = 5.25 ny = 0
nw = 4 nh = 3
else
nx = 0 ny = 3
nw = 4 nh = 1
end
t = t .. string.format([[
hypertext[%f,%f;%f,%f;note;<global valign=middle halign=justify size=20>%s]
]], nx,ny,nw,nh, minetest.formspec_escape(props.note))
end
if k.icon then img = k.icon(result) end
if k.outdesc then ot = k.outdesc(result) else ot = desc_builtin(result) end
-- image[%f,%f;1,1;gui_furnace_arrow_bg.png^[transformR270]
return t .. string.format([[
item_image[%f,%f;1,1;%s]tooltip[%f,%f;1,1;%s]
]] --[[box[%f,%f;1,1;#850083A0]] .. [[
%s[%f,%f;1,1;%s]
tooltip[%f,%f;1,1;%s]
]], k.w, k.h/2 - 0.5, k.node,
k.w, k.h/2 - 0.5, minetest.formspec_escape(minetest.registered_nodes[k.node].description),
-- k.w+1, k.h/2 - 0.5,
img and 'image' or 'item_image',
k.w+1.1, k.h/2 - 0.5, minetest.formspec_escape(img or result),
k.w+1.1, k.h/2 - 0.5, minetest.formspec_escape(ot))
end;
local retrieve_recipe = function(kind,out,notes_right)
local rec = recipe_kinds[kind]
|
>
|
>
|
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>
|
|
|
|
|
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
...
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
...
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
...
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
|
dye = { caption = 'Any Dye', cnitem = 'dye:black' };
bone = { caption = 'Any Bone', cnitem = 'bonemeal:bone' };
vessel = { caption = 'Any Bottle', cnitem = 'vessels:glass_bottle' };
flower = { caption = 'Any Flower', cnitem = 'flowers:rose' };
mushroom = { caption = 'Any Mushroom', cnitem = 'flowers:mushroom_brown' };
water_bucket = { caption = 'Water Bucket', cnitem = 'bucket:bucket_water' };
sorcery_ley_cable = { caption = 'Cable', cnitem = 'sorcery:cable_vidrium' };
scissors = { caption = 'Scissors', cnitem = 'sorcery:scissors_steel' };
};
}
sorcery.cookbook.constants = constants
local slot3x3 = {
{0,0}, {1,0}, {2,0};
{0,1}, {1,1}, {2,1};
................................................................................
desc = string.format("%s (%u)",desc,s:get_count())
end
return desc
end;
local bookadjs = { -- sets are in reverse order!
{'Celestial', 'Divine', 'Inspired', 'Heavenly';
'Mystic', 'Diabolic', 'Luminous', 'Forsaken',
'Ethereal'};
{'Dark', 'Perfected', 'Flawless', 'Unthinkable';
'Impossible', 'Worrisome', 'Unimpeachable', 'Fulsome',
'Wise'};
{'Splendid', 'Magnificent', 'Sublime', 'Grand';
'Beneficent', 'Mysterious', 'Peculiar', 'Eerie';
'Fulsome', 'Fearsome', 'Curious', 'Fascinating';
'Notorious', 'Infamous', 'Wondrous'};
}
local cache = {
populate_grindables = function(cache)
if not cache.grindables then
cache.grindables = {}
for k,v in pairs(minetest.registered_items) do
................................................................................
local rec = {}
local en = sorcery.data.enchants[name]
if not en then return nil end
en = en.recipe
for i,e in pairs(en) do
if e.lens then
rec[i] = 'sorcery:lens_' .. e.lens .. '_' .. e.gem
elseif e.item then
rec[i] = e.item
end
if e.consume or (e.item and not e.dmg) then
rec[i] = rec[i] .. ' ' .. tostring(e.consume or 1) -- :/
end
end
return rec
end;
props = function(name)
local ench = sorcery.data.enchants[name]
local p = ench.info
local desc = ''
if ench.cost ~= 0 then
desc = string.format('%s <b>%i</b> thaum-second%s of charge when tool is used',
ench.cost > 0 and 'Consumes' or 'Generates',
math.abs(ench.cost),
ench.cost ~= 1 and 's' or ''
)
end
if p == nil then return {note = desc} end
if p.note then return p end
return sorcery.lib.tbl.proto({note = desc},p)
end;
slots = {
{0.5,0};
{0,1}, {1,1}
};
title = function(name) return sorcery.data.enchants[name].name end;
outdesc = function(name,suffix)
local e = sorcery.data.enchants[name]
local cap = sorcery.lib.str.capitalize
local aff = sorcery.data.affinities[e.affinity]
return sorcery.lib.ui.tooltip {
title = e.name;
desc = cap(e.desc);
color = sorcery.lib.color(e.tone);
props = {
{
title = string.format('%s affinity', cap(e.affinity));
desc = aff.desc;
color = sorcery.lib.color(aff.color);
};
};
}
end;
};
-- spells = {
-- booksuf = 'Spellbook';
-- slots = {
-- {0,0}, {1,0};
................................................................................
end
end
end
local img, ot
if props.note then
local nx, ny, nw, nh
if notes_right then
nx = 5.25 - (3 - k.w) -- :/
ny = 0
nw = 4 nh = k.h
else
nx = 0 ny = 3
nw = 4 nh = k,h
end
t = t .. string.format([[
hypertext[%f,%f;%f,%f;note;<global valign=middle halign=justify size=20>%s]
]], nx,ny,nw,nh, minetest.formspec_escape(props.note))
end
if k.icon then img = k.icon(result) end
if k.outdesc then ot = k.outdesc(result) else ot = desc_builtin(result) end
-- image[%f,%f;1,1;gui_furnace_arrow_bg.png^[transformR270]
return t .. string.format([[
item_image[%f,%f;1,1;%s]tooltip[%f,%f;1,1;%s]
box[%f,%f;1.1,1.1;#1a001650]
%s[%f,%f;1,1;%s]
tooltip[%f,%f;1,1;%s]
]], k.w, k.h/2 - 0.5, k.node,
k.w, k.h/2 - 0.5, minetest.formspec_escape(minetest.registered_nodes[k.node].description),
k.w+1.05, k.h/2 - 0.55,
img and 'image' or 'item_image',
k.w+1.1, k.h/2 - 0.5, minetest.formspec_escape(img or result),
k.w+1.1, k.h/2 - 0.5, minetest.formspec_escape(ot))
end;
local retrieve_recipe = function(kind,out,notes_right)
local rec = recipe_kinds[kind]
|