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
|
// TMW-2 script.
// Author:
// Jesusalva
// Description:
// Recipe Books in TMW2
- script #RecipeBook NPC_HIDDEN,{
function showRecipe;
function readCooking;
function readAlchemy;
function readCrafting;
OnUse:
setnpcdialogtitle l("Recipe Book");
mesc l("You open the Recipe Book. Each recipe you get can be put here.");
next;
do {
mesc l("Which recipes do you want to read?");
select
l("Nothing."),
l("Cooking Recipes."),
l("Alchemy Recipes."),
l("Crafting Recipes.");
mes "";
switch (@menu) {
case 2:
readCooking(); break;
case 3:
readAlchemy(); break;
case 4:
readCrafting(); break;
}
} while (@menu != 1);
closeclientdialog;
close;
// Expects: @scope$
// showRecipe( Craft, Bonus, {amount 1, item 1}, {amount 2, item 2}... )
function showRecipe {
if (getargcount() < 3 || getargcount() % 2 != 0 || @scope$ == "")
return Exception("Faulty recipe skill command invoked - error");
// getd("$RECIPES_ALCHEMY_"+getcharid(2)+"["+getarg(0)+"]")
if (getd("RECIPES_"+@scope$+"["+getarg(0)+"]")) {
if (getarg(1)) {
mes l(".:: @@ Recipe ::.", getitemlink(getarg(1)));
for (.@i=2;.@i < getargcount(); .@i++) {
mesc l("@@/@@ @@", countitem(getarg(.@i+1)), getarg(.@i), getitemlink(getarg(.@i+1)));
.@i++;
}
mes "";
}
return 1;
}
//debugmes "Nope, nothing here";
return 0;
}
// =============================== Cooking Functions
function readCooking {
setnpcdialogtitle l("Cooking Recipes");
@scope$="COOKING";
mesc l("Eating is a necessity, but cooking is an art.");
mesc l("(All items must be placed exactly in this order.)");
next;
mesc l("List of known cooking recipes:");
mes "";
showRecipe(0, Iten, WarpedLog, 9999);
next;
@scope$="";
return;
}
// =============================== Cooking Functions
function readAlchemy {
setnpcdialogtitle l("Alchemy Recipes");
@scope$="ALCHEMY";
mesc l("Alchemy. The art of having quasi-magical effects without magic.");
mesc l("(All items must be placed exactly in this order.)");
next;
mesc l("List of known alchemy recipes:");
mes "";
// Healing
mesc "----------"+l("Healing Recipes")+"----------", 2;
showRecipe(CraftPiberriesInfusion, PiberriesInfusion,
5, Piberries, 1, Curshroom);
next;
// General Boosts
mesc "----------"+l("General Recipes")+"----------", 2;
showRecipe(CraftHastePotion, HastePotion,
15, Plushroom);
showRecipe(CraftStrengthPotion, StrengthPotion,
15, Chagashroom);
showRecipe(CraftResetPotion, StatusResetPotion,
90, ManaPiouFeathers, 10, Curshroom);
showRecipe(CraftSpeedPotion, MoveSpeedPotion,
1, GemPowder, 5, FluoPowder);
showRecipe(CraftPrecisionPotion, PrecisionPotion,
3, Piberries, 1, MountainSnakeEgg);
showRecipe(CraftDodgePotion, DodgePotion,
3, Piberries, 1, SnakeEgg);
next;
// Stats Boosts
mesc "----------"+l("Stat Boost Recipes")+"----------", 2;
showRecipe(CraftLukPotionA, LukPotionA,
1, EmeraldPowder, 1, HerbalTea);
showRecipe(CraftLukPotionB, LukPotionB,
1, Emerald, 2, HerbalTea);
showRecipe(CraftLukPotionC, LukPotionC,
1, PolishedEmerald, 3, HerbalTea);
showRecipe(CraftDexPotionA, DexPotionA,
1, AmethystPowder, 1, HerbalTea);
showRecipe(CraftDexPotionB, DexPotionB,
1, Amethyst, 2, HerbalTea);
showRecipe(CraftDexPotionC, DexPotionC,
1, PolishedAmethyst, 3, HerbalTea);
showRecipe(CraftIntPotionA, IntPotionA,
1, SapphirePowder, 1, HerbalTea);
showRecipe(CraftIntPotionB, IntPotionB,
1, Sapphire, 2, HerbalTea);
showRecipe(CraftIntPotionC, IntPotionC,
1, PolishedSapphire, 3, HerbalTea);
showRecipe(CraftVitPotionA, VitPotionA,
1, DiamondPowder, 1, HerbalTea);
showRecipe(CraftVitPotionB, VitPotionB,
1, Diamond, 2, HerbalTea);
showRecipe(CraftVitPotionC, VitPotionC,
1, PolishedDiamond, 3, HerbalTea);
showRecipe(CraftAgiPotionA, AgiPotionA,
1, TopazPowder, 1, HerbalTea);
showRecipe(CraftAgiPotionB, AgiPotionB,
1, Topaz, 2, HerbalTea);
showRecipe(CraftAgiPotionC, AgiPotionC,
1, PolishedTopaz, 3, HerbalTea);
next;
@scope$="";
return;
}
// =============================== Crafting Functions
function readCrafting {
setnpcdialogtitle l("Crafting Recipes");
@scope$="EQUIPMENT";
mesc l("There is only one way towards the best equipment: Smith away!");
mesc l("(All items must be placed exactly in this order.)");
next;
mesc l("List of known crafting recipes:");
mes "";
showRecipe(0, Iten, WarpedLog, 9999);
next;
@scope$="";
return;
}
OnInit:
.sex = G_OTHER;
.distance = 1;
end;
}
// Below this line are utils for Gacha. We use callfunc() on itemDB.
// Types: CRAFT_COOKING, CRAFT_ALCHEMY, CRAFT_EQUIPMENT
// Rarity: 1 - basic, 2 - intermediary, 4 - advanced, 8 - expert, 16 - master
// Level equivalents: 1: (1~20) 2: (21~44), 3: (45~75), 4: (76~99), 5: 100+
function script MakeBlueprint {
.@type=getarg(0, -1);
.@rarity=getarg(1, 1);
switch (.@type) {
case CRAFT_ALCHEMY:
if (.@rarity & CRAFT_BASIC) {
array_push(.@recipes, CraftPiberriesInfusion);
array_push(.@recipes, CraftHastePotion);
array_push(.@recipes, CraftStrengthPotion);
}
if (.@rarity & CRAFT_INTERMEDIARY) {
array_push(.@recipes, CraftLukPotionA);
array_push(.@recipes, CraftDexPotionA);
array_push(.@recipes, CraftIntPotionA);
array_push(.@recipes, CraftAgiPotionA);
array_push(.@recipes, CraftVitPotionA);
array_push(.@recipes, CraftSpeedPotion);
}
if (.@rarity & CRAFT_ADVANCED) {
array_push(.@recipes, CraftResetPotion);
array_push(.@recipes, CraftPrecisionPotion);
array_push(.@recipes, CraftDodgePotion);
}
if (.@rarity & CRAFT_EXPERT) {
array_push(.@recipes, CraftLukPotionB);
array_push(.@recipes, CraftDexPotionB);
array_push(.@recipes, CraftIntPotionB);
array_push(.@recipes, CraftAgiPotionB);
array_push(.@recipes, CraftVitPotionB);
}
if (.@rarity & CRAFT_MASTER) {
array_push(.@recipes, CraftLukPotionC);
array_push(.@recipes, CraftDexPotionC);
array_push(.@recipes, CraftIntPotionC);
array_push(.@recipes, CraftAgiPotionC);
array_push(.@recipes, CraftVitPotionC);
}
// Now you'll learn some recipe!
.@rcp=any_of(.@recipes);
if (RECIPES_ALCHEMY[.@rcp]) {
dispbottom l("It was a recipe you already knew...");
getexp (BaseLevel+JobLevel)*rand(1,.@rarity), JobLevel+rand(1,.@rarity);
} else {
dispbottom l("Learned a new recipe!");
RECIPES_ALCHEMY[.@rcp]=true;
}
break;
default:
return Exception("Invalid blueprint type "+.@type+" - item was lost.");
}
return;
}
|