summaryrefslogtreecommitdiff
path: root/npc/craft/recipes.txt
blob: db2449e610526955368de61a3c190a8e189568c5 (plain) (blame)
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
386
387
388
389
390
391
392
393
394
395
396
397
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
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
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
// 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( recipe{, recipe...} )
function showRecipe {
    if (@scope$ == "")
        return Exception("Faulty recipe skill command invoked - error");

    freeloop(true);
    for (.@a = 0; .@a < getargcount(); ++.@a) {
        .@const$ = data_to_string(getarg(.@a));

        if (startswith(.@const$, "Craft")) {
            // infer the item constant from the craft constant
            .@recipe = getarg(.@a);

            .@item = string_to_data(substr(.@const$, 5, getstrlen(.@const$) - 1));
        } else {
            // infer the craft constant from the item constant
            .@recipe = string_to_data(sprintf("Craft%s", .@const$));
            .@item = getarg(.@a);
        }

        if (.@item <= 0) {
            // target item not found
            consolebug("ERROR, INVALID ITEM ID DETECTED at showRecipe");
            continue;
        }

        if (!getd("RECIPES_"+@scope$+"["+.@recipe+"]") && !$@GM_OVERRIDE) {
            // does not have the recipe
            continue;
        }

        for (.@inv = 0; .@inv < 9; ++.@inv) {
            .@size = getcraftrecipe(.@recipe, .@inv, .@qty[0], .@item_id[0]);

            if (.@size < 0) {
                if (.@size == -1) {
                    // recipe does not exist
                    break;
                }
                // inventory does not exist
                break;
            }

            mes(l(".:: %s Recipe ::.", getitemlink(.@item)));

            for (.@it = 0; .@it < .@size; ++.@it) {
                .@recipe_item = .@item_id[.@it];
                .@recipe_qty = .@qty[.@it];

                if (.@recipe_item <= 0) {
                    break;
                }

                mesc(sprintf("%d/%d %s", countitem(.@recipe_item), .@recipe_qty, getitemlink(.@recipe_item)));
            }

            mes("");
            .@count++;
        }
    }
    freeloop(false);

    return .@count > 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(PiberriesInfusion,
               AtroposMixture,
               Coffee);
    dnext;

    // General Boosts
    mesc "----------"+l("General Boosts")+"----------", 2;
    showRecipe(HastePotion,
               StrengthPotion,
               StatusResetPotion,
               HomunResetPotion,
               MoveSpeedPotion,
               PrecisionPotion,
               DodgePotion,
               SacredLifePotion,
               SacredManaPotion,
               SacredImmortalityPotion,
               MagicApple);
    dnext;

    // Stats Boosts
    mesc "----------"+l("Stat Boost Recipes")+"----------", 2;
    showRecipe(LukPotionA,
               LukPotionB,
               LukPotionC);

    showRecipe(IntPotionA,
               IntPotionB,
               IntPotionC);

    showRecipe(VitPotionA,
               VitPotionB,
               VitPotionC);

    showRecipe(AgiPotionA,
               AgiPotionB,
               AgiPotionC);

    showRecipe(DexPotionA,
               DexPotionB,
               DexPotionC);

    // General Stuff
    mesc "----------"+l("Reagents & Other Potions")+"----------", 2;
    showRecipe(IcedBottle,
               PurificationPotion,
               DeathPotion,
               BrokenWarpCrystal,
               SmokeGrenade,
               ScentGrenade,
               Grenade,
               Insurance,
               InsuranceContract);

    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 "";
    // Melee Weapons: Never use Titanium nor Lead. Iron-based, no silver
    mesc "----------"+l("One Hand Weapon Recipes")+"----------", 2;
    showRecipe(Dagger,
               WoodenSword,
               BugSlayer,
               ShortGladius,
               Backsword,
               ShortSword,
               Kitana,
               BoneKnife,
               LongSword,
               RockKnife,
               DivineSword);
    dnext;
    // Two Hands Melee Weapons: Never use Titanium nor Lead. Silver-based.
    mesc "----------"+l("Two Hands Weapon Recipes")+"----------", 2;
    // Reserved ID 63 and 64
    // Halberd is really cheap as it doesn't uses Platinum/Iridium :P
    showRecipe(MiereCleaver,
               Broadsword,
               Halberd,
               ImmortalSword);

    dnext;
    // Archery Weapons: Always use Wood, Root and Carp.
    mesc "----------"+l("Archery Weapon Recipes")+"----------", 2;
    showRecipe(ShortBow,
               ForestBow,
               ElficBow,
               ChampionshipBow,
               BansheeBow);
    dnext;
    // Magical Weapons: Wood + powders
    mesc "----------"+l("Magical Weapon Recipes")+"----------", 2;
    showRecipe(TrainingWand,
               NoviceWand,
               ApprenticeWand,
               LeaderWand,
               MysticWand);
    dnext;
    // Firestaff Weapons: Lead + Titanium
    mesc "----------"+l("Fire Staffs Recipes")+"----------", 2;
    showRecipe(PynRevolver,
               PynRifle,
               PynGatling,
               PynShotgun);
    dnext;
    // Shields: May use Leather. Titanium or Lead, but never both
    mesc "----------"+l("Shield Recipes")+"----------", 2;
    // Exception to shield rule: Braknar Shield
    showRecipe(WoodenShield,
               BladeShield,
               BraknarShield,
               BritShield,
               BromenalShield,
               BlueKnightShield,
               SteelShield,
               DragonShield,
               SaviorShield);
    dnext;
    // Chest Armors -> Primary Ore + Secondary Ore + Iron Powder + Earth Powder
    mesc "----------"+l("Chest Armor Recipes")+"----------", 2;
    showRecipe(LeatherShirt,
               LieutenantArmor,
               Chainmail,
               CopperArmor,
               LightPlatemail,
               GoldenLightPlatemail,
               WarlordPlate,
               GoldenWarlordPlate,
               BromenalChest,
               AssassinChest);
    dnext;
    // Pants -> Primary Item + Secondary Item + Leather Patch + Earth Powder
    mesc "----------"+l("Pants Recipes")+"----------", 2;
    showRecipe(JeansShorts,
               RaidTrousers,
               LeatherTrousers,
               JeansChaps,
               SilkPants,
               ChainmailSkirt,
               BromenalPants,
               WarlordPants,
               AssassinPants);
    dnext;
    // Gloves: Gloves items
    mesc "----------"+l("Gloves Recipes")+"----------", 2;
    showRecipe(SilkGloves,
               LeatherGloves,
               BromenalGloves,
               ManaGloves,
               WarlordGloves,
               AssassinGloves);
    dnext;
    // Helmets: Helmet items
    mesc "----------"+l("Helmet Recipes")+"----------", 2;
    showRecipe(InfantryHelmet,
               DesertHelmet,
               BromenalHelmet,
               CandleHelmet,
               CrusadeHelmet,
               WarlordHelmet,
               VikingHelmet,
               TerraniteHelmet,
               CenturionHelmet,
               BullHelmet,
               DarkHelm,
               DarkKnightHelmet,
               SamuraiHelmet);
    dnext;
    // Misc: Misc items
    mesc "----------"+l("Miscellaneous Recipes")+"----------", 2;
    showRecipe(GoldenRing,
               TerranitePants,
               TerraniteArmor,
               Skypiercer);
    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) {
        /////////////////////////////////////////////////////
        ///// Alchemy Recipes
        /////////////////////////////////////////////////////
        case CRAFT_ALCHEMY:
            if (.@rarity & CRAFT_BASIC) {
                array_push(.@recipes, CraftPiberriesInfusion);
                array_push(.@recipes, CraftHastePotion);
                array_push(.@recipes, CraftStrengthPotion);
                array_push(.@recipes, CraftCoffee);
            }
            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);
                array_push(.@recipes, CraftIcedBottle);
                array_push(.@recipes, CraftInsuranceContract);
            }
            if (.@rarity & CRAFT_ADVANCED) {
                array_push(.@recipes, CraftResetPotion);
                array_push(.@recipes, CraftPrecisionPotion);
                array_push(.@recipes, CraftDodgePotion);
                array_push(.@recipes, CraftDeathPotion);
                array_push(.@recipes, CraftSmokeGrenade);
                array_push(.@recipes, CraftScentGrenade);
                array_push(.@recipes, CraftGrenade);
                array_push(.@recipes, CraftInsurance);
            }
            if (.@rarity & CRAFT_EXPERT) {
                array_push(.@recipes, CraftLukPotionB);
                array_push(.@recipes, CraftDexPotionB);
                array_push(.@recipes, CraftIntPotionB);
                array_push(.@recipes, CraftAgiPotionB);
                array_push(.@recipes, CraftVitPotionB);
                array_push(.@recipes, CraftAtroposMixture);
                array_push(.@recipes, CraftPurificationPotion);
                array_push(.@recipes, CraftHomunResetPotion);
            }
            if (.@rarity & CRAFT_MASTER) {
                array_push(.@recipes, CraftLukPotionC);
                array_push(.@recipes, CraftDexPotionC);
                array_push(.@recipes, CraftIntPotionC);
                array_push(.@recipes, CraftAgiPotionC);
                array_push(.@recipes, CraftVitPotionC);
                array_push(.@recipes, CraftSacredLifePotion);
                array_push(.@recipes, CraftSacredManaPotion);
                array_push(.@recipes, CraftSacredImmortalityPotion);
                array_push(.@recipes, CraftBrokenWarpCrystal);
                array_push(.@recipes, CraftMagicApple);
            }

            // Now you'll learn some recipe!
            .@rcp=any_of(.@recipes);
            if (RECIPES_ALCHEMY[.@rcp]) {
                .@mpot=rand2(900, 1000*.@rarity);
                dispbottom l("It was a recipe you already knew... (+ @@ Mobpt)", .@mpot);
                getexp (BaseLevel+JobLevel)*rand2(1,.@rarity), JobLevel+rand2(1,.@rarity);
                // Give you some Monster Points to use with Intense Beard
                // You do NOT need to be registered with Aidan for this.
                Mobpt+=.@mpot;
            } else {
                dispbottom l("Learned a new recipe!");
                RECIPES_ALCHEMY[.@rcp]=true;
            }
            break;
        /////////////////////////////////////////////////////
        ///// Equipment Recipes
        /////////////////////////////////////////////////////
//                array_push(.@recipes, Craft);
        case CRAFT_EQUIPMENT:
            if (.@rarity & CRAFT_BASIC) {
                array_push(.@recipes, CraftWoodenSword);
                array_push(.@recipes, CraftWoodenShield);
                array_push(.@recipes, CraftTrainingWand);
                array_push(.@recipes, CraftShortBow);
                array_push(.@recipes, CraftSilkGloves);
                array_push(.@recipes, CraftInfantryHelmet);
                array_push(.@recipes, CraftLeatherShirt);
                array_push(.@recipes, CraftJeansShorts);
            }
            if (.@rarity & CRAFT_INTERMEDIARY) {
                array_push(.@recipes, CraftBugSlayer);
                array_push(.@recipes, CraftShortGladius);
                array_push(.@recipes, CraftMiereCleaver);
                array_push(.@recipes, CraftBladeShield);
                array_push(.@recipes, CraftNoviceWand);
                array_push(.@recipes, CraftForestBow);
                array_push(.@recipes, CraftLeatherGloves);
                array_push(.@recipes, CraftDesertHelmet);
                array_push(.@recipes, CraftBromenalHelmet);
                array_push(.@recipes, CraftLieutenantArmor);
                array_push(.@recipes, CraftRaidTrousers);
            }
            if (.@rarity & CRAFT_ADVANCED) {
                array_push(.@recipes, CraftBacksword);
                array_push(.@recipes, CraftShortSword);
                array_push(.@recipes, CraftBoneKnife);
                array_push(.@recipes, CraftKitana);
                array_push(.@recipes, CraftBroadsword);
                array_push(.@recipes, CraftPynRevolver);
                array_push(.@recipes, CraftApprenticeWand);
                array_push(.@recipes, CraftElficBow);
                array_push(.@recipes, CraftBritShield);
                array_push(.@recipes, CraftBromenalShield);
                array_push(.@recipes, CraftBlueKnightShield);
                array_push(.@recipes, CraftBromenalGloves);
                array_push(.@recipes, CraftCandleHelmet);
                array_push(.@recipes, CraftCrusadeHelmet);
                array_push(.@recipes, CraftWarlordHelmet);
                array_push(.@recipes, CraftVikingHelmet);
                array_push(.@recipes, CraftChainmail);
                array_push(.@recipes, CraftCopperArmor);
                array_push(.@recipes, CraftLightPlatemail);
                array_push(.@recipes, CraftWarlordPlate);
                array_push(.@recipes, CraftBromenalChest);
                array_push(.@recipes, CraftLeatherTrousers);
                array_push(.@recipes, CraftJeansChaps);
                array_push(.@recipes, CraftSilkPants);
                array_push(.@recipes, CraftChainmailSkirt);
                array_push(.@recipes, CraftBromenalPants);
                array_push(.@recipes, CraftWarlordPants);
            }
            if (.@rarity & CRAFT_EXPERT) {
                array_push(.@recipes, CraftGoldenRing);
                array_push(.@recipes, CraftLongSword);
                array_push(.@recipes, CraftRockKnife);
                array_push(.@recipes, CraftHalberd);
                array_push(.@recipes, CraftPynRifle);
                array_push(.@recipes, CraftPynGatling);
                array_push(.@recipes, CraftLeaderWand);
                array_push(.@recipes, CraftChampionshipBow);
                array_push(.@recipes, CraftSteelShield);
                array_push(.@recipes, CraftDragonShield);
                array_push(.@recipes, CraftManaGloves);
                array_push(.@recipes, CraftWarlordGloves);
                array_push(.@recipes, CraftTerraniteHelmet);
                array_push(.@recipes, CraftCenturionHelmet);
                array_push(.@recipes, CraftBullHelmet);
                array_push(.@recipes, CraftDarkHelm);
                array_push(.@recipes, CraftTerraniteArmor);
                array_push(.@recipes, CraftTerranitePants);
                array_push(.@recipes, CraftAssassinChest);
                array_push(.@recipes, CraftAssassinPants);
           }
            if (.@rarity & CRAFT_MASTER) {
                array_push(.@recipes, CraftDivineSword);
                array_push(.@recipes, CraftImmortalSword);
                array_push(.@recipes, CraftPynShotgun);
                array_push(.@recipes, CraftMysticWand);
                array_push(.@recipes, CraftBansheeBow);
                array_push(.@recipes, CraftAssassinGloves);
                array_push(.@recipes, CraftDarkKnightHelmet);
                array_push(.@recipes, CraftSamuraiHelmet);
            }

            // Now you'll learn some recipe!
            .@rcp=any_of(.@recipes);

			// Double precision failsafe
            if (RECIPES_EQUIPMENT[.@rcp])
	            .@rcp=any_of(.@recipes);

			// Maybe you already knew it?
            if (RECIPES_EQUIPMENT[.@rcp]) {
                .@mpot=rand2(900*.@rarity, 1000*.@rarity);
                dispbottom l("It was a recipe you already knew... (+ @@ Mobpt)", .@mpot);
                getexp (BaseLevel+JobLevel)*rand2(1,.@rarity), JobLevel+rand2(1,.@rarity);
                // Give you some Monster Points to use with Intense Beard
                // You do NOT need to be registered with Aidan for this.
                Mobpt+=.@mpot;
            } else {
                dispbottom l("Learned a new recipe!");
                RECIPES_EQUIPMENT[.@rcp]=true;
            }
            break;
        default:
            return Exception("Invalid blueprint type "+.@type+" - item was lost.");
    }
    return;
}

// Create a blueprint based on level. Extra chance for weaker Blueprint.
// Level equivalents: 1: (1~20) 2: (21~44), 3: (45~75), 4: (76~99), 5: 100+
function	script	MakeRandomBlueprint	{
    array_push(.@blueprints, AlchemyBlueprintA);
    array_push(.@blueprints, EquipmentBlueprintA);
    if (BaseLevel > 20) {
        array_push(.@blueprints, AlchemyBlueprintB);
        array_push(.@blueprints, EquipmentBlueprintB);
    }
    if (BaseLevel > 44) {
        array_push(.@blueprints, AlchemyBlueprintB);
        array_push(.@blueprints, EquipmentBlueprintB);
        array_push(.@blueprints, AlchemyBlueprintC);
        array_push(.@blueprints, EquipmentBlueprintC);
    }
    if (BaseLevel > 75) {
        array_push(.@blueprints, AlchemyBlueprintC);
        array_push(.@blueprints, EquipmentBlueprintC);
        array_push(.@blueprints, AlchemyBlueprintD);
        array_push(.@blueprints, EquipmentBlueprintD);
    }
    if (BaseLevel > 100) {
        array_push(.@blueprints, AlchemyBlueprintD);
        array_push(.@blueprints, EquipmentBlueprintD);
        if (any(true,false)) {
            array_push(.@blueprints, AlchemyBlueprintE);
            array_push(.@blueprints, EquipmentBlueprintE);
        }
    }
    getitem any_of(.@blueprints), 1;
    return;
}