summaryrefslogtreecommitdiff
path: root/npc/024-16/craftsman.txt
blob: 3f8ba548a6e1e6a143948aabd7cb944995e57822 (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
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Craftmaster, teaches player TMW2_CRAFT

024-16,27,42,0	script	Dwarf Craftsmaster	NPC_DWARF_CRAFTMASTER,{
    function calcRequisites;
    function calcPrices;
    if (.@q < 13) {
        hello;
        end;
    }
    mesn;
    mesq lg("Look what we have here, it is a girl!", "Look what we have here, it is a boy!");
    next;
    mesn;
    mesq l("I'm Thurgar the mighty craftsman. I can make anything reality! But I only work to the king!");
    next;
    mesn;
    mesq l("...Unless, of course, if you're interested in learning this art. You'll not regret it, I assure you.");
    next;
    // Main Loop
    mesc l("Crafting Skill Level: @@", getskilllv(TMW2_CRAFT));
    mesc l("Completed Crafts: @@/@@", CRAFTING_SCORE, calcRequisites());
    mesc l("Money: @@ GP", format_number(Zeny)), 3;
    mes "";
    select
        rif(calcRequisites(), l("Learn crafting for @@ GP", format_number(calcPrices())) ),
        l("Nothing for now, thanks.");
    close;

// Calc successful crafts required to learn crafting
// Returns amount of crafts needed
function calcRequisites {
    switch (getskilllv(TMW2_CRAFT)) {
    case 0:
        return 1;
    case 1:
        return 3;
    case 2:
        return 7;
    case 3:
        return 12;
    case 4:
        return 18;
    case 5:
        return 24;
    case 6:
        return 32;
    }
    return false;
}

// Calc how much GP the skill will cost you
// Returns amount of GP
function calcPrices {
    switch (getskilllv(TMW2_CRAFT)) {
    case 0:
        return 1000;
    case 1:
        return 5000;
    case 2:
        return 9000;
    case 3:
        return 15000;
    case 4:
        return 27000;
    case 5:
        return 36000;
    case 6:
        return 50000;
    }
    return false;
}

OnInit:
    .distance=5;
    end;
}