-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.twee
123 lines (97 loc) · 3.1 KB
/
index.twee
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
:: StoryTitle
Simple Inventory 3 - Crafting
:: StoryData
{
"format": "SugarCube",
"format-version": "2.36.1",
"ifid": "862E1FA6-35C6-4E10-BB86-D720812D1528"
}
:: Story JavaScript [script]
Config.ui.stowBarInitially = false;
:: StoryInit
<<newinv $materials>>
<<newinv $equipment>>
<<set setup.recipes = new Map([
["axe", { wood : 3, stone : 1 }],
["pickaxe", { wood : 2, stone : 2 }],
["sword", { wood : 1, iron : 2 }]
])>>
:: StoryMenu
<<link "Materials">>
<<run Dialog.setup("Materials", "inventory"); Dialog.wiki(Story.get("MaterialInventory").text); Dialog.open()>>
<</link>>
<<link "Equipment">>
<<run Dialog.setup("Equipment", "inventory"); Dialog.wiki(Story.get("EquipmentInventory").text); Dialog.open()>>
<</link>>
:: MaterialInventory
<<inv $materials>>
:: EquipmentInventory
<<inv $equipment>>
:: CraftingUI [nobr]
<ul>
<<for _item, _materials range setup.recipes>>
<<capture _materials _item>>
<li>
_item (Requires: <<for _mat, _num range _materials>>
<<= _mat + " x" + _num + " ">>
<</for>>)
<<if $materials.compare(_materials)>>
<<button "Craft">>
<<run $materials.unmerge(_materials)>>
<<pickup $equipment _item 1>>
<<replace "#crafting-interface">><<include "CraftingUI">><</replace>>
<</button>>
<<else>>
Not enough materials.
<</if>>
</li>
<</capture>>
<</for>>
</ul>
:: Crafting [nobr]
<h2>Choose an item to craft:</h2>
<div id="crafting-interface">
<<include "CraftingUI">>
</div>
<br><br>
[[Back to the forest|Start]]
:: Stones
Stones: @@#mats;<<= $materials.count("stone")>>@@
You go to gather stones.
<<button "Gather by hand">>
<<pickup $materials "stone" 1>>
<<replace "#mats">><<= $materials.count("stone")>><</replace>>
<</button>>\
<<if $equipment.has("pickaxe")>><<button "Use the pickaxe">>
<<pickup $materials "stone" 2>>
<<replace "#mats">><<= $materials.count("stone")>><</replace>>
<</button>><</if>>
[[Back to the forest|Start]]
:: Wood
Wood: @@#mats;<<= $materials.count("wood")>>@@
You go to gather some wood.
<<button "Gather by hand">>
<<pickup $materials "wood" 1>>
<<replace "#mats">><<= $materials.count("wood")>><</replace>>
<</button>>\
<<if $equipment.has("axe")>><<button "Use the axe">>
<<pickup $materials "wood" 2>>
<<replace "#mats">><<= $materials.count("wood")>><</replace>>
<</button>><</if>>
[[Back to the forest|Start]]
:: Iron
Iron: @@#mats;<<= $materials.count("iron")>>@@
You go to gather some iron.
<<if $equipment.has("pickaxe")>><<button "Use the pickaxe">>
<<pickup $materials "iron" 1>>
<<replace "#mats">><<= $materials.count("iron")>><</replace>>
<</button>><<else>>\
You don't have the right tools to gather iron…\
<</if>>
[[Back to the forest|Start]]
:: Start
You find yourself in a large, oddly blocky forest.
[[Gather stones|Stones]]
[[Gather wood|Wood]]
[[Gather iron|Iron]]
[[Go to the crafting table|Crafting]]