summaryrefslogtreecommitdiff
path: root/npc/024-1/john.txt
blob: 8fa2559e89875f086581c84add57186c075abdb1 (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
// TMW2 scripts.
// Author:
//    Jesusalva
// Description:
//    John H

024-1,154,45,0	script	Jhon Henryfield	NPC_PLAYER,{
	if (BaseLevel < 42) {
        asleep();
		end;
	}
	.@q=getq(FrostiaQuest_JhonH);

    // Quest failed
    if (.@q == 8) {
        mesn;
        mesq l("Go away creep, I HATE YOU!");
        close;
    }

    if (!.@q) {
		mesn;
		mesc l("ZZZzzzz...");
        mesc l("%s seems to be asleep... Maybe we can wake him up somehow?", .name$);
        next;
        do
        {
            select
                l("Poke him"),
                l("Attack him"),
                l("Give him an item");
            mes "";
            if (@menu == 1) {
                mesc l("No reply. We should try something else.");
                next;
            } else if (@menu == 2) {
                mesn;
                mesc l("*Opening eyes in a shock*");
                mesq l("AAAAaaahhhhh!!!");
                setq FrostiaQuest_JhonH, 8; // Quest failed
                close;
            } else {
                mes "##B" + l("Drag and drop an item from your inventory.") + "##b";

                .@give = requestitem();
                if (.@give < 1) continue;
                if (!countitem(.@give)) continue;
                if (checkbound(.@give)) continue;
                if (getiteminfo(.@give, ITEMINFO_TYPE) != IT_HEALING &&
                    getiteminfo(.@give, ITEMINFO_TYPE) != IT_USABLE) continue;
                mesc l("Really give a %s to Jhon?", getitemlink(.@give));
                mesc l("The item will be lost forever."), 1;
                next;
                if (askyesno() == ASK_NO) continue;
                mes "";
                delitem .@give, 1;
                if (.@give == Coffee) {
                    setq FrostiaQuest_JhonH, 1;
                    .@q = 1;
                    getexp 250, 25;
                    mesn;
                    mesq l("Coffee! I'm awake now!");
                    next;
                    break;
                } else {
                    mesc l("...No reaction...");
                    next;
                }
            }
        } while (true);
    }
    ///////////////////////////
    if (!.@q) close;
    do
    {
        mesn;
        mesq l("How can I help you, my friend?");
        next;
        select
            l("Who are you?"),
            rif(.@q >= 2 && countitem(Coffee), l("Do you want more coffee?")),
            l("Nothing, thanks anyway.");
        mes "";
        switch (@menu) {
        case 1:
            mesn;
            mesq l("Name is Jhon, and that's not a typo! I am an absolute coffee lover, and I travel to exotic places in search of the perfect brew.");
            next;
            mesn;
            mesq l("Unfortunately, elves doesn't like to share coffee, so I thought in leaving but fell asleep. Oops!");
            next;
            mesn;
            mesq l("If you have some coffee to me, I'll buy it of your hands.");
            compareandsetq FrostiaQuest_JhonH, 2;
            .@q = max(.@q, 2);
            next;
            break;
        case 2:
            mesc l("How much coffee you'll give Jhon?");
            input .@c, 0, countitem(Coffee);
            mes "";
            .@c = min(.@c, countitem(Coffee));
            if (.@c < 1) break;
            delitem Coffee, .@c;
            .@q2 = getq2(FrostiaQuest_JhonH) + .@c;
            .@q3 = getq3(FrostiaQuest_JhonH);
            setq2 FrostiaQuest_JhonH, .@q2;
            .@xp = 250 + rand2(getiteminfo(Coffee, ITEMINFO_SELLPRICE) / 3);
            .@gp = getiteminfo(Coffee, ITEMINFO_SELLPRICE) * 2 / 3; // 67% GP
            Zeny += .@c * .@gp;
            getexp .@c * .@xp, .@c * 25; // ~33% EXP + bonus
            mesn;
            mesq lg("Thanks, gal!", "Thanks, pal!");
            next;
            switch (.@q3) {
            case 0:
                if (.@q2 >= 1) {
                    inventoryplace Potatoz, 1;
                    getitem Potatoz, 1;
                    setq3 FrostiaQuest_JhonH, .@q3 + 1;
                }
                break;
            case 1:
                if (.@q2 >= 5) {
                    inventoryplace IcedBottle, 1;
                    getitem IcedBottle, 1;
                    setq3 FrostiaQuest_JhonH, .@q3 + 1;
                }
                break;
            case 2:
                if (.@q2 >= 10) {
                    inventoryplace ScrollBattlePlansA, 1;
                    getitem ScrollBattlePlansA, 1;
                    setq3 FrostiaQuest_JhonH, .@q3 + 1;
                }
                break;
            case 3:
                if (.@q2 >= 15) {
                    inventoryplace ScrollDefenseBlessA, 1;
                    getitem ScrollDefenseBlessA, 1;
                    setq3 FrostiaQuest_JhonH, .@q3 + 1;
                }
                break;
            case 4:
                if (.@q2 >= 20) {
                    inventoryplace ScrollSYeti, 1;
                    getitem ScrollSYeti, 1;
                    setq3 FrostiaQuest_JhonH, .@q3 + 1;
                }
                break;
            case 5:
                if (.@q2 >= 25) {
                    inventoryplace AlchemyBlueprintA, 1;
                    getitem AlchemyBlueprintA, 1;
                    setq3 FrostiaQuest_JhonH, .@q3 + 1;
                }
                break;
            case 6:
                if (.@q2 >= 30) {
                    inventoryplace AlchemyBlueprintB, 1;
                    getitem AlchemyBlueprintB, 1;
                    setq3 FrostiaQuest_JhonH, .@q3 + 1;
                }
                break;
            case 7:
                if (.@q2 >= 40) {
                    inventoryplace AlchemyBlueprintC, 1;
                    getitem AlchemyBlueprintC, 1;
                    setq3 FrostiaQuest_JhonH, .@q3 + 1;
                }
                break;
            case 8:
                if (.@q2 >= 50) {
                    inventoryplace AlchemyBlueprintD, 1;
                    getitem AlchemyBlueprintD, 1;
                    setq3 FrostiaQuest_JhonH, .@q3 + 1;
                }
                break;
            }
            // Item acquired?
            if (getq3(FrostiaQuest_JhonH) != .@q3) {
                mesn;
                mesq l("Here, you can have this, token of my appreciation.");
                next;
            }
            break;
        default:
            .@q = 12; break;
        }
    } while (.@q < 8);

    closeclientdialog;
    goodbye;
    close;

OnInit:
    .@npcId = getnpcid(.name$);
    setunitdata(.@npcId, UDT_HEADTOP, AFKCap);
    setunitdata(.@npcId, UDT_HEADMIDDLE, SilkRobe); // TODO
    setunitdata(.@npcId, UDT_WEAPON, DeepBlackBoots);
    setunitdata(.@npcId, UDT_HAIRSTYLE, 22);
    setunitdata(.@npcId, UDT_HAIRCOLOR, 5);
    npcsit;

    .sex = G_MALE;
    .distance = 4;
    end;
}