summaryrefslogtreecommitdiff
path: root/world/map/npc/009-2/peter.txt
blob: ba742424fd71e501400a9fc56924a3820d7843de (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
// Nicholas' Apprentice and Armorsmith

009-2.gat,183,57,0|script|Peter|157,{

    set @peter_chain_mail_coal, 10;
    set @peter_chain_mail_ingot, 5;
    set @peter_chain_mail_money, 20000;

    set @peter_light_plate_coal, 20;
    set @peter_light_plate_ingot, 10;
    set @peter_light_plate_money, 50000;

    set @peter_warlord_plate_coal, 30;
    set @peter_warlord_plate_ingot, 15;
    set @peter_warlord_plate_money, 100000;

    mes "[Peter]";
    mes "\"Hello, I am Peter, apprentice to Nicholas.\"";
    next;
    mes "\"I can make you some sturdy armor: you must give me Iron Ingots to craft with and some gold pieces for my efforts.\"";
    next;
    mes "[Peter]";
    mes "\"What would you like me to make?\"";
    menu
        "Chain Mail ("+@peter_chain_mail_coal+" coal, "+@peter_chain_mail_ingot+" ingots and "+@peter_chain_mail_money+" GP).", L_Peter_Chain_Mail,
        "Light Plate ("+@peter_light_plate_coal+" coal, "+@peter_light_plate_ingot+" ingots and "+@peter_light_plate_money+" GP).", L_Peter_Light_Plate,
        "Warlord Plate ("+@peter_warlord_plate_coal+" coal, "+@peter_warlord_plate_ingot+" ingots and "+@peter_warlord_plate_money+" GP).", L_Peter_Warlord_Plate,
        "Nevermind.", -;
    goto L_Close;

L_Peter_Chain_Mail:
    set @peter_crafting_coal, @peter_chain_mail_coal;
    set @peter_crafting_iron_ingot, @peter_chain_mail_ingot;
    set @peter_crafting_money, @peter_chain_mail_money;
    set @peter_crafting_item$, "ChainmailShirt";
    callsub S_Peter_Get_Smithery_Item;
    goto L_Close;

L_Peter_Light_Plate:
    set @peter_crafting_coal, @peter_light_plate_coal;
    set @peter_crafting_iron_ingot, @peter_light_plate_ingot;
    set @peter_crafting_money, @peter_light_plate_money;
    set @peter_crafting_item$, "LightPlatemail";
    callsub S_Peter_Get_Smithery_Item;
    goto L_Close;

L_Peter_Warlord_Plate:
    set @peter_crafting_coal, @peter_warlord_plate_coal;
    set @peter_crafting_iron_ingot, @peter_warlord_plate_ingot;
    set @peter_crafting_money, @peter_warlord_plate_money;
    set @peter_crafting_item$, "WarlordPlate";
    callsub S_Peter_Get_Smithery_Item;
    goto L_Close;

S_Peter_Get_Smithery_Item:
    if (Zeny < @peter_crafting_money)
        goto L_Peter_NotEnough_Zeny;
    if (countitem("IronIngot") < @peter_crafting_iron_ingot)
        goto L_Peter_NotEnough_Ingot;
    if (countitem("Coal") < @peter_crafting_coal)
        goto L_Peter_NotEnough_Coal;
    getinventorylist;
    if (@inventorylist_count == 100)
        goto L_Peter_TooMany;
    set Zeny, Zeny - @peter_crafting_money;
    delitem "IronIngot", @peter_crafting_iron_ingot;
    delitem "Coal", @peter_crafting_coal;
    getitem @peter_crafting_item$, 1;
    mes "[Peter]";
    mes "\"Here you go!\"";
    return;

L_Peter_NotEnough_Zeny:
    mes "[Peter]";
    mes "\"You don't have enough gold.\"";
    goto L_Close;

L_Peter_NotEnough_Ingot:
    mes "[Peter]";
    mes "\"You don't have enough ingots.\"";
    goto L_Close;

L_Peter_NotEnough_Coal:
    mes "[Peter]";
    mes "\"You don't have enough Coal.\"";
    goto L_Close;

L_Peter_TooMany:
    mes "[Peter]";
    mes "\"You have too much stuff.  Please get rid of something if you want some armor.\"";
    goto L_Close;

L_Close:
    // Clear all local variables
    set @peter_chain_mail_coal, 0;
    set @peter_chain_mail_ingot, 0;
    set @peter_chain_mail_money, 0;

    set @peter_light_plate_coal, 0;
    set @peter_light_plate_ingot, 0;
    set @peter_light_plate_money, 0;

    set @peter_warlord_plate_coal, 0;
    set @peter_warlord_plate_ingot, 0;
    set @peter_warlord_plate_money, 0;

    set @peter_crafting_coal, 0;
    set @peter_crafting_iron_ingot, 0;
    set @peter_crafting_money, 0;
    set @peter_crafting_item$, "";
    close;

}