summaryrefslogtreecommitdiff
path: root/world/map/npc/009-1/jack.txt
blob: 9e1ebbe127e54ef4a9c9304c12939bacd61b9c66 (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
//#################################################################################
//#                                                                               #
//# This script file contains the npc scripts for two quests:                     #
//#                                                                               #
//# Quest1: Obtaining a Forest bow                                                #
//# Needed: About 20 Raw logs, 5000gp, some chatting and running                  #
//# Reward: Forest bow                                                            #
//#                                                                               #
//# Quest2: Obtaining a Wooden shield                                             #
//# Needed: 40 Raw logs, 5000gp                                                   #
//# Reward: Wooden shield and 2500exp                                             #
//#                                                                               #
//# Variables used:  @QUEST_Forestbow_state, nibbles 0 and 1                      #
//#################################################################################

// Lumberjack
009-1.gat,40,45,0|script|Jack|141,{
    callfunc "ClearVariables";

    set @RAWLOGS_AMOUNT, 40;
    set @SHIELD_COST, 5000;
    set @QUEST_SHIELD_EXP, 2500;

    set @Q_Forestbow_MASK, NIBBLE_0_MASK;
    set @Q_Forestbow_SHIFT, NIBBLE_0_SHIFT;

    set @Q_Woodenshield_MASK, NIBBLE_1_MASK;
    set @Q_Woodenshield_SHIFT, NIBBLE_1_SHIFT;

    set @Q_Forestbow, ((QUEST_Forestbow_state & @Q_Forestbow_MASK) >> @Q_Forestbow_SHIFT);
    set @Q_Woodenshield, ((QUEST_Forestbow_state & @Q_Woodenshield_MASK) >> @Q_Woodenshield_SHIFT);

    set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);

    if (@Q_Woodenshield >= 3) goto L_Shield_state_3;
    if (@Q_Woodenshield == 2) goto L_Shield_state_2;
    if (@Q_Woodenshield == 1) goto L_Shield_state_1;
    if (@Q_Forestbow > 1) goto L_Bow_state_2;

    mes "[Jack Lumber]";
    mes "\"Hello there, my name is Jack Lumber, the enemy of all trees.  If you need some firewood just let me know.\"";
    if (@inspector == 1)
        callsub S_NohMask_Ask;
    next;
    if (@Q_Forestbow < 1)
        goto L_Close;
    menu
        "I heard you aren't delivering any more living wood. Why not?", -;
    mes "[Jack Lumber]";
    mes "\"Why not?! I value my life, that's why!.\"";
    next;
    menu
        "What do you mean?", -;
    mes "[Jack Lumber]";
    mes "\"A week ago I was going to chop down one of those twigleaf trees in the forest to the southwest. These twigleafs are the trees that give me the living wood you speak of. I was just chopping away with my axe and what happened? One of its branches hit me! I thought it fell down or the wind blew it. It hurt! I shook it off and struck it again with my axe and another branch hit me! I got angry and started to chop off all the branches near the ground so this couldn't happen anymore. But I still can't believe what happened next.\"";
    next;
    menu
        "What happened? ", -;
    mes "[Jack Lumber]";
    mes "\"You'll think I am insane when I tell you.\"";
    next;
    menu
        "I won't. I promise.", -;
    mes "[Jack Lumber]";
    mes "\"OK. After I chopped off a few branches the whole tree started to move. Its roots tore out of the earth, all the branches started to wave around and a face appeared on the trunk. The whole tree CAME TO LIFE! It was mad!\"";
    next;
    menu
        "Did you run away?", -,
        "Did you fight it?", -;
    mes "[Jack Lumber]";
    mes "\"I fought, of course! I took my axe and attacked the beast! It hit me here *points at a bruise at his shoulder*, here *lifts his trouser leg to show another bruise* and here *lifts his shirt and reveals some even worse bruises*. But I didn't give up. I chopped away at it, branch after branch, and in the end I chopped off its roots and it fell to the ground motionless.\"";
    next;
    menu
        "So you beat the monster? Then why are you so scared?", -;
    mes "[Jack Lumber]";
    mes "\"Well, I was exhausted and had to rest. A few minutes passed and suddenly I was surrounded by a dozen or more of these living trees!\"";
    next;
    menu
        "Did you fight them, too? ", -;
    mes "[Jack Lumber]";
    mes "\"Are you crazy? I barely destroyed one of those beasts. I was in no shape to fight again. I ran away as fast as I could. Lucky for me the monsters aren't that fast on their tiny root legs. Ha!\"";
    next;
    menu
        "So you aren't chopping down trees anymore?", -;
    mes "[Jack Lumber]";
    mes "\"I still do. It's my job. But I no longer chop those twigleafs, I'll tell you that. I know the bowyer master wants some wood from them, but I don't care. I won't risk my life for a few gold pieces. If you want to, just go to the southwest. But I won't go there ever again.\"";
    next;
    menu
        "Southwest you say? OK, thank you.", -;
    set @Q_Forestbow, 2;
    callsub S_Update_Mask;
    goto L_Close;

L_Bow_state_2:
    // Bow state 4: The player has found a perfect piece of wood.
    if (@Q_Forestbow > 3) goto L_Bow_state_4;

    mes "\"Good luck hunting those tree monsters - you will need it.\"";
    if (@inspector == 1)
        callsub S_NohMask_Ask;
    goto L_Close;

L_Bow_state_4:
    mes "[Jack Lumber]";
    mes "\"You've finally found that perfect piece of living wood Alan needs to make a Forest bow, haven't you?\"";
    next;
    menu
        "I couldn't afford the bow, though...", L_Shield_state_0,
        "No, I'm still looking.", L_Bow_state_4_reaffirm,
        "Yes, I've got the Forest bow now.", -,
        "I'm a melee warrior, I don't need bows.", L_Shield_state_0;

    // Check if the player tells the truth (continue on in any case)
    if (@Q_Forestbow > 4) goto L_Shield_state_0;

    mes "[Jack Lumber]";
    mes "\"Hrmph. I'm someone who respects those speaking the truth.\"";
    next;
    goto L_Shield_state_0;

L_Bow_state_4_reaffirm:
    mes "[Jack Lumber]";
    mes "\"You should go talk to Alan again.\"";
    goto L_Close;

L_Shield_state_0:
    set @Q_Woodenshield, 1;
    callsub S_Update_Mask;

    if (Sex == 0)
        set @child_of_jack$, "daughter";
    if (Sex == 1)
        set @child_of_jack$, "son";

    mes "[Jack Lumber]";
    mes "\"You no doubt remember how I struggled with those beasts, fighting for my life. Scared me, those seven-branched little stumps did!  Never since that day have I strayed near them.  And here comes you, cutting them down one by one.  I'm proud of you, to dare those trunks a fight. You're strong as if you were my own " + @child_of_jack$ + "!\"";
    next;
    goto L_Shield_state_1;

L_Shield_state_1:
    mes "[Jack Lumber]";
    mes "\"I have an idea.  What would you say about a new shield?\"";
    next;
    if (@inspector == 1)
        menu
            "No thanks.", L_Close,
            "Yes, please!", L_Yes,
            "Actually, I'd like to know if you've seen any strange happenings in town.", L_NohMask_Answer;
    menu
        "No thanks.", L_Close,
        "Yes, please!", L_Yes;

L_Yes:
    mes "[Jack Lumber]";
    mes "\"All I need is " + @RAWLOGS_AMOUNT + " raw logs.  This needn't be highest-quality wood; pretty much any log you can find should work.   Oh, and I'll also need " + @SHIELD_COST + " GP for other materials.\"";
    next;
    set @Q_Woodenshield, 2;
    callsub S_Update_Mask;
    goto L_Close;

L_Shield_state_2:
    mes "[Jack Lumber]";
    mes "\"Let's see if you have enough of everything.\"";
    next;
    if (countitem("RawLog") < @RAWLOGS_AMOUNT)
        goto L_Not_enough_logs;
    if (Zeny < @SHIELD_COST)
        goto L_Not_enough_money;
    getinventorylist;
    if (@inventorylist_count == 100)
        goto L_TooMany;
    delitem "RawLog", @RAWLOGS_AMOUNT;
    set Zeny, Zeny - @SHIELD_COST;
    getexp @QUEST_SHIELD_EXP, 0;
    getitem "WoodenShield", 1;
    set @Q_Woodenshield, 3;
    callsub S_Update_Mask;
    mes "[Jack Lumber]";
    mes "\"Have a seat.\"";
    mes "Jack saws the logs into pieces, then shaves them until they are smooth to the touch.";
    mes "Applying some strong-smelling liquid, he tans them in darker hues.";
    next;
    mes "[Jack Lumber]";
    mes "Grabbing one of two leftover pieces, he begins to carve it into a round shape, then repeats this with the second piece-- shield handles, from what you can tell.";
    next;
    mes "[Jack Lumber]";
    mes "Meanwhile, the sun has dried the other pieces.  Jack places them next to each other, adds a frame, and nails everything together.";
    mes "The resulting shield looks usable already, but Jack applies another liquid to it and leaves it to dry for a few moments.";
    next;
    mes "[Jack Lumber]";
    mes "Finally, he hands the shield to you.";
    mes "\"Enjoy your new shield!\"";
    mes "[" + @QUEST_SHIELD_EXP + " experience points]";
    next;
    goto L_Close;

L_Not_enough_logs:
    mes "[Jack Lumber]";
    mes "\"You don't have enough wood for me to craft this shield; I need a total of " + @RAWLOGS_AMOUNT + " raw logs.\"";
    goto L_Close;

L_Not_enough_money:
    mes "[Jack Lumber]";
    mes "\"You don't have enough gold, I'm afraid.  I need " + @SHIELD_COST + " GP to finish your shield.\"";
    goto L_Close;

L_TooMany:
    mes "[Jack Lumber]";
    mes "\"You don't have enough room for the shield. Come back when you do.\"";
    goto L_Close;

L_Shield_state_3:
    mes "[Jack Lumber]";
    mes "\"I hope that my shield will serve you well!\"";
    if (@inspector != 1)
        goto L_Close;
    next;
    menu
        "Me too.", L_Close,
        "Have you seen anything that might be connected to the recent robberies in town?", L_NohMask_Answer;

// This is an ugly violation of the scripting standards,
// but it's somewhat complicated to fix.
S_NohMask_Ask:
    next;
    menu
        "I'll keep that in mind.", -,
        "Have you seen anything that might be connected to the recent robberies in town?", L_NohMask_Answer;
    return;

L_NohMask_Answer:
    mes "[Jack Lumber]";
    mes "\"Sorry, no.\"";
    goto L_Close;

L_Close:
    set @inspector, 0;
    close;

S_Update_Mask:
    set QUEST_Forestbow_state, (QUEST_Forestbow_state & ~(@Q_Forestbow_MASK | @Q_Woodenshield_MASK)) | (@Q_Forestbow << @Q_Forestbow_SHIFT) | (@Q_Woodenshield << @Q_Woodenshield_SHIFT);
    return;
}