summaryrefslogtreecommitdiff
path: root/npc/002-1/peter.txt
blob: 0d5af2fd27f5a2dbd75942c6c7f3f23a72d14935 (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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
// TMW2 script
// Author:
//   Jesusalva
// Original evol script authors: 4144, Ablu, Alastrim, Qwerty Dragon, Reid, Vasily_Makarov
// Description:
//    Rat hunter.
// Variable:
//    ShipQuests_Peter
// Values:
//    0   Doesn't know the quest.
//    & 1   Task given.
//    & 2   Task completed (easy level).
//    & 4   Task completed (medium level).
//    & 8   Task completed (hard level).
// Setq2:
//      Number of killed Rattos:
//      & 1 - Ratto 1
//      & 2 - Ratto 2
//      & 4 - Ratto 3
//      & 8 - Ratto 4
//      = 15: All rattos killed
// Setq3:
//      Instance ID (so we can destroy it later)
//
// Others:
// @peter = Accepted Task ID
// @pt_mob = ID of the monster you were tasked with killing

// FIXME: ugly workaround, causes lots of bugs (specially instancing)
002-1,35,24,0	script	AreaNPC#Peter	NPC_HIDDEN,0,1,{
    end;
OnTouch:
    doevent "Peter::OnPeterMain";
    close;
}

002-1,33,25,0	script	Peter	NPC_RATTO_SAILOR,{
    goto L_Main;

OnPeterMain:
L_Main:
    .@q = getq(ShipQuests_Peter);
    .@q2 = getq2(ShipQuests_Peter);
    .@q3 = getq3(ShipQuests_Peter);
    if (BaseLevel < 8) goto OnTooWeak;

    if (!.@q || !isinstance(.@q3) || .@q3 <= 0) goto L_Task;
    if (instanceowner(.@q3) != getcharid(3)) goto L_Task;
    if (.@q2 < 15) goto L_ReturnFail;
    dispbottom l("I am broken?! Please report! Debug data: @@ (@@)", .@q, .@q2);
    close;

OnGiveTask:
L_Task:
    if (!.@q)
        setq ShipQuests_Peter, 1, 0, -1;
    mesn;
    mesq lg("Hey, girl!", "Hey, man!");
    next;
    mesq l("I need somebody who can rid the hold of the ship of these creatures. Can you help me?");
    next;

    menu
        l("Yeah, but what reward will I get?"), L_BonusTask,
        l("No, they are way too dangerous for me!"), -;

    mes "";
    mesn;
    mesq l("Hehe, hehe. Well, come back if you change your mind.");

    close;

OnLowTime:
    if ((compare(getmap(), "002-2")) || (compare(getmap(), "nard")))
        dispbottom l("Time is running out... Hurry up!");
    end;

OnTooWeak:
    mesn;
    mesq lg("I need someone to help me clean the edge of the ship, but you aren't strong enough for now.");
    close;

OnStop:
    slide 35, 26;

    mesn;
    mesq l("You can't go there!");

    close;

OnReturnFail:
L_ReturnFail:
    .@q3 = getq3(ShipQuests_Peter);
    //instance_destroy(.@q3);
    setq2 ShipQuests_Peter, 0;
    setq3 ShipQuests_Peter, -1;
    deltimer("RattosControl::OnRatto1Respawn");
    deltimer("RattosControl::OnRatto2Respawn");
    deltimer("RattosControl::OnRatto3Respawn");
    deltimer("RattosControl::OnRatto4Respawn");
    mesn;
    mesq l("I see it's not so easy to get rid of the monsters. Do you want to try again?");
    next;

    menu
        l("Yeah, but I would like to make sure I get a reward."), L_BonusTask,
        l("No, they are way too dangerous for me!"), -;

    mes "";
    mesn;
    mesq l("Hehe, hehe. Well, come back if you change your mind.");

    close;

L_BonusTask:
    mes "";
    mesn;
    mesq l("There are three kind of monsters which frequently attacks our fair vessel.");
    next;
    mesn;
    .@q = getq(ShipQuests_Peter);
    if (!(.@q & 2)) {
        mes l("- I currently need your help with @@.", getmonsterlink(Squirrel)); // 750 HP, don't attack, 110 ms
        mes l("I'll give you @@ GP for this job.", 350);
        mes "";
    }
    if (!(.@q & 4)) {
        mes l("- I currently need your help with @@.", getmonsterlink(Ratto)); // 500 HP, 80 DMG, 1572 dps, 120 ms
        mes l("I'll give you @@ GP for this job.", 550);
        mes "";
    }
    if (!(.@q & 8)) {
        mes l("- I currently need your help with @@.", getmonsterlink(Croc)); // 1900 HP, 145 DMG, 1872 dps, 600 ms
        mes l("I'll give you @@ GP for this job.", 1000);
        mes "";
    }
    // TODO: This could be done a daily quest
    if (.@q == 15) {
        mes l("- I currently need your help with @@, but there's no reward.", getmonsterlink(Ratto));
    }
    next;

    select
        l("I'm not feeling like it today... Sorry."),
        rif(!(.@q & 2), l("I will take the @@ Bounty.", "Squirrel")),
        rif(!(.@q & 4), l("I will take the @@ Bounty.", "Ratto")),
        rif(!(.@q & 8), l("I will take the @@ Bounty.", "Croc")),
        rif(.@q == 15, l("Why not, I need to train anyway."));

    if (@menu == 1)
        close;

    @peter=@menu;

    goto L_Start;


L_Start:
    mes "";
    mesc l("Some of them are pretty strong. Do you need an explanation about hit'n'run and the monster you're about to face?");
    if (askyesno() == ASK_YES) {
        mes "";
        mesc l(".:: Hit'n'Run Tactic ::.");
        mesc l("Sometimes, you just cannot afford to be hit. But even with a melee weapon, you don't need to be hit.");
        next;
        mesc l("The strategy is simple. When you hit the enemy, walk one or two tiles backwards.");
        mesc l("If you miss, walk two or three tiles backwards. This way, you avoid being hit.");
        next;
        if (@peter == 2)
            mesc l("Squirrels are healthy, but they never attack. They run away from you, so good luck catching it!");
        else if (@peter == 4)
            mesc l("Crocs are dangerous and very healthy, but very slow. Use that on your advantage.");
        else
            mesc l("Rattos are very fast. They walk fast and attack fast. I advise bringing some healing items!");
        next;
    }

// Init Instance
OnStartOutside:
    .@ID=getcharid(0);
    @MAP_NAME$="nard@"+str(.@ID); // Max 4 chars for map name
    .@INSTID = instance_create("002-2@a"+(.@ID), getcharid(3), IOT_CHAR);
    if (.@INSTID < 0)
        .@instanceMapName$ = "";
    else
        .@instanceMapName$ = instance_attachmap("002-2", .@INSTID, 0, @MAP_NAME$);

    // Instance already exists, or something went wrong
    if (.@instanceMapName$ == "") {
        mesn;
        mesq l("Actually, you just took a bounty, right?");
        next;
        mesn;
        mesq l("Why don't you take a break? Breath in some fresh air. The basement is pretty damp.");
        close;
    }

    setq2 ShipQuests_Peter, 0;
    setq3 ShipQuests_Peter, .@INSTID;

    // It'll be self-destroyed when time runs out (3 minutes)
    instance_set_timeout(180, 180, .@INSTID);
    instance_init(.@INSTID);

    // Save in a less reliable way the challenge you took
    if (@peter == 2) {
        @peter=2;
        @pt_mob=Squirrel;
    } else if (@peter == 3) {
        @peter=4;
        @pt_mob=Ratto;
    } else if (@peter == 4) {
        @peter=8;
        @pt_mob=Croc;
    } else {
        @peter=0;
        @pt_mob=Ratto;
    }

    warp @MAP_NAME$, 33, 24;
    addtimer(120000, "Peter::OnLowTime");
    addtimer(140000, "Peter::OnTimeout");

    // Spawn the Monsters
    areamonster @MAP_NAME$, 23, 19, 57, 40, strmobinfo(1, @pt_mob), @pt_mob, 1, "RattosControl::OnRatto1Death";
    areamonster @MAP_NAME$, 23, 19, 57, 40, strmobinfo(1, @pt_mob), @pt_mob, 1, "RattosControl::OnRatto2Death";
    areamonster @MAP_NAME$, 23, 19, 57, 40, strmobinfo(1, @pt_mob), @pt_mob, 1, "RattosControl::OnRatto3Death";
    areamonster @MAP_NAME$, 23, 19, 57, 40, strmobinfo(1, @pt_mob), @pt_mob, 1, "RattosControl::OnRatto4Death";

    dispbottom l("Okay, you can start!");
    closeclientdialog;
    close;

OnTimeout:
    if (!(compare(getmap(), "002-2")) && !(compare(getmap(), "nard")))
        end;
    warp "002-1@"+LOCATION$, 35, 26;
    .@q3 = getq3(ShipQuests_Peter);
    //instance_destroy(.@q3);
    setq2 ShipQuests_Peter, 0;
    setq3 ShipQuests_Peter, -1;
    deltimer("RattosControl::OnRatto1Respawn");
    deltimer("RattosControl::OnRatto2Respawn");
    deltimer("RattosControl::OnRatto3Respawn");
    deltimer("RattosControl::OnRatto4Respawn");
    mesn;
    mesq l("Hey! Be careful. You can't stay in this basement for so long, you're going to get sick. Come outside and take a break, maybe you can try again later.");
    close;

OnDone:
    .@q3 = getq3(ShipQuests_Peter);
    //instance_destroy(.@q3);
    setq ShipQuests_Peter, getq(ShipQuests_Peter)|@peter, 0, -1;

    .@q = getq(ShipQuests_Peter);
    if (@peter) {
        mesn;
        mesq l("Good job!") + " " + l("Here's your reward!");
        getexp @peter*52, @peter;
        switch (@peter) {
            case 2: @peter=350; break;
            case 4: @peter=550; break;
            case 8: @peter=1000; break;
        }

        Zeny = Zeny + @peter;
        message strcharinfo(0), l("You receive @@ GP!", @peter);
    } else {
        mesn;
        mesq l("Good job!") + " " + l("Thanks for helping!");
        getexp 0, (JobLevel > 6 ? (15+JobLevel) : 4);
        PETER_REPEAT += 1

        // Every 3 repeats (10 minutes) gives you 50 GP
        if (PETER_REPEAT % 3 == 0) {
            Zeny += 50;
            mesq l("It is not much, but here is %d GP. Should buy you a snack!", 50);
        }

        // Special bonus (but unlike Kreist, this one is decorative only)
        // (Takes about 6 hours non-stop to obtain)
        if (PETER_REPEAT == 100) {
            mesq l("I'm moved to tears by your dedication to help us. Unrewarded, even. Here, have this rare %s. For free!", getitemlink(Cap));
            getitem Cap, 1;
        }
    }
    deltimer("Peter::OnLowTime");
    deltimer("Peter::OnTimeout");
    @peter=0;
    if (!getq(ShipQuests_Dan)) {
        next;
        mesn;
        mesq l("You're strong, maybe you could help Dan. He is a good sailor but he is too afraid from harmless Pious.");
        next;
        mesn;
        mesq l("Look at that pathetic scene, he just put his chair over the desk... Chef Gado won't like it.");
    }
    close;

OnInit:
    .sex = G_MALE;
    .distance = 5;
    end;
}