summaryrefslogtreecommitdiff
path: root/npc/craft/recipes.txt
blob: b60b9830d9c197024fa75dc2825b6213cf900c9d (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
// 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, {item 1, amount 1}, {item 2, amount 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)) {
            mesn l(".:: @@ Recipe ::.", getitemlink(getarg(1)));

            for (.@i=2;.@i < getargcount(); .@i++) {
                mesc l("@@/@@ @@", countitem(getarg(.@i)), getarg(.@i+1), getitemlink(getarg(.@i)));
                .@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 readCooking {
    setnpcdialogtitle l("Alchemy Recipes");
    @scope$="ALCHEMY";

    mesc l("Burn burn!");
    mesc l("(All items must be placed exactly in this order.)");
    next;
    mesc l("List of known alchemy recipes:");
    mes "";
    showRecipe(0, Iten, WarpedLog, 9999);
    next;
    @scope$="";
    return;
}

// =============================== Crafting Functions
function readCrafting {
    setnpcdialogtitle l("Crafting Recipes");
    @scope$="EQUIPMENT";

    mesc l("Smith smith!");
    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;