summaryrefslogtreecommitdiff
path: root/npc/004-2/mirio.txt
blob: 4c149eb4fa1ffaf7d55c52c96a61a522bee63c0d (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
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Part of Speed Run Quest
// Structure:
//    HalinarzoQuest_Speed( state, time, record )

004-2,146,115,0	script	Mirio	NPC_INDIGENOUS_YOUNG,1,1,{
    function neutral;
    function naked;
    function disarmed;
    function hungry;
    function speed;
    function start;
    function slow;
    function running;
    function restricted;
    function retry;
    .@q = getq(HalinarzoQuest_Speed);
    .@t = getq2(HalinarzoQuest_Speed);
    .@r = getq3(HalinarzoQuest_Speed);
    if (BaseLevel < 40) neutral();
    if (getequipid(EQI_HEAD_MID) < 1) naked();
    if (getequipid(EQI_HEAD_TOP) < 1) naked();
    if (getequipid(EQI_HAND_R) < 1) disarmed();
    if (getequipid(EQI_HAND_L) < 1) disarmed();
    if (@pachua) running();
    if (.@q <= 0) hungry();
    if (.@q == 1) speed();
    if (.@q < 10) retry();
    neutral();
    close;

function neutral {
    mesn;
    mesq l("Howdy! Pachua and I scout this canyon to protect our clan. I acknowledge only those whom are fast like the wind! I would love to challenge you for a race... But not today.");
    close;
}

function naked {
    mesn;
    mesq l("...I know it is hot in this desert, but if you don't wear some armor and a hat, monsters will get to you. Really harsh, nowadays.");
    close;
}

function disarmed {
    .@pn$ = lg("girl", "dude");
    mesn;
    mesq l("...%s, as far as you should be concerned, this is an hostile land and I'm not your friend. You should use a weapon and a shield if possible. Never trust strangers, specially if they look like an assassin... exactly like me.", .@pn$);
    close;
}

function slow {
    mesn;
    mesq l("...Try allocating some points in agility before we continue. I think %d should be suffice.", getarg(0, 40));
    close;
}

function restricted {
    mesn;
    mesq l("Sorry, but this quest cannot be done by staff.");
    close;
}

function hungry {
    .@pn$ = lg("gal", "pal");
    mesn;
    mesq l("Howdy, partner! Man, you have no idea how I'm hungry. Been scouting this canyon for weeks, under the scorching sun, and there's only snake meat to eat... I'm get tired of this repulsive stuff.");
    next;
    mesn;
    mesq l("So let's strike a deal, bring me %d %s, %d %s, %d %s, and a %s. I'll reward you, promise.",
           10, getitemlink(LettuceLeaf),
            5, getitemlink(Cheese),
            2, getitemlink(TonoriDelight),
            getitemlink(HalfCroconut));
    next;
    select
        l("Sure, I'll be back."),
        l("I have everything you asked me.");
    mes "";
    if (@menu == 1) closeclientdialog;
    if (@menu == 2) {
        if (countitem(LettuceLeaf)   < 10 ||
            countitem(Cheese)        < 5 ||
            countitem(TonoriDelight) < 2 ||
            countitem(HalfCroconut)  < 1) {
            mesc l("A dagger is stuck to your heart."), 1;
            mesn;
            mesq l("Told ya, %s, should know better than to mess with an... assassin!", .@pn$);
            percentheal -100, 0;
            close;
        }
        inventoryplace CaveSnakeSkin, 1, SnakeSkin, 1;
        delitem LettuceLeaf, 10;
        delitem Cheese, 5;
        delitem TonoriDelight, 2;
        delitem HalfCroconut, 1;
        getitem SnakeSkin, 1;
        getitem CaveSnakeSkin, 1;
        setq HalinarzoQuest_Speed, 1;
        mesn;
        mesq l("Ah, good. You didn't even bother poisoning it? Hahah, that's great, %s! Here is a couple skins I had lying around, may be useful.", .@pn$);
        next;
        mesn;
        mesq l("How about this, I can teach you how to be a tiny bit faster, so you can use heavier armor. I'll even give you a discount. Give it some thought, come back to me after you make up your mind.");
    }
    close;
}

/////////////////////////////////////////////////////////////////////////////////
function speed {
    if (is_staff() && !$@GM_OVERRIDE && !debug) restricted();
    if (readparam2(bAgi) < 40) slow();
    mesn;
    mesq l("Have you thought on my proposal? I'll only charge you %d GP or a %s for each attempt made.", .price, getitemlink(.alt));
    next;
    select
        l("Not now, thanks."),
        rif(Zeny >= .price, l("I'll pay the GP.")),
        rif(countitem(.alt), l("I'll give you the item."));
    mes "";
    if (@menu == 1) close;
    if (@menu == 2) Zeny -= .price;
    if (@menu == 3) delitem .alt, 1;
    start();
    return;
}

function start {
    mesn;
    mesq l("Great! It is simple, really. Pachua and I are scouting the desert. Run as fast as you can to Pachua, and then run back here. Pachua will send a smoke signal when you talk to him, so I'll know you haven't cheated.");
    next;
    mesn;
    mesq l("Try to make a good time, and... Good luck! On my signal, 3, 2, 1...");
    next;
    setq2 HalinarzoQuest_Speed, gettimetick(2) + 1; // Grace time due @refresh
    @pachua = 1;
    slide 146, 115;
    closeclientdialog;
    // META: How they know your name? ...Via label, obviously.
    npctalk3 l("GO! Run, %s, RUN!!!!", strcharinfo(0));
    atcommand("@refresh");
    close;
}

function running {
    if (@pachua < 2) {
        npctalk3 l("What are you waiting for?! Get running, Pachua is waiting!");
        closeclientdialog;
        close;
    }
    // Pachua == 2, completed the run
    .@to = getq2(HalinarzoQuest_Speed);
    .@q = getq(HalinarzoQuest_Speed);
    .@t = gettimetick(2) - .@to;
    .@r = getq3(HalinarzoQuest_Speed);
    @pachua = 0;
    mesn;
    mesq l("...And stop! You took %s this time!", FuzzyTime(.@to));
    if (.@t < 15) {
        mesc l("That's obviously impossible, so I'll voiding your result!");
        close;
    }
    if (.@t < .@r) {
        mesc l("That's %d seconds better than your previous record!", .@r - .@t);
    }
    if (!.@r || .@t < .@r)
        setq3 HalinarzoQuest_Speed, .@t;
    setq2 HalinarzoQuest_Speed, 0;
    next;
    // Condition
    .@g = 320 - (.@q * 20);
    if (.@t > .@g) {
        mesn;
        mesq l("You took more than %s to do this, that is lame! Better luck next time.", FuzzyTime(.@g));
        // Consolation Prize
        if (.@t < 450) {
            next;
            mesn;
            mesq l("...Well, I'll refund you 10% because it was not utterly terrible.");
            Zeny += .price / 10;
        }
        // MISSION FAILED
        mesc l("RACE FAILED."), 1;
        close;
    }
    // Ooh, you did it!
    setq1 HalinarzoQuest_Speed, .@q + 1;
    getexp 2500, 0;
    mesn;
    mesq l("I'm proud of you!");
    if (getq(HalinarzoQuest_Speed) < 10)
        mesc l("Feel free to try again whenever.");
    close;
}

function retry {
    if (is_staff() && !$@GM_OVERRIDE && !debug) restricted;
    .@q = getq(HalinarzoQuest_Speed);
    .@p = .price * .@q;
    .@s = 40 + (.@q * 5);
    if (readparam2(bAgi) < .@s) slow(.@s);
    mesn;
    mesq l("To retry, I will charge you %d GP or %d %s for each attempt made. You'll have less time to finish as well.", .@p, .@q * 2, getitemlink(.alt));
    next;
    select
        l("Not now, thanks."),
        rif(Zeny >= .@p, l("I'll pay the GP.")),
        rif(countitem(.alt) >= .@q * 2, l("I'll give you the item."));
    mes "";
    if (@menu == 1) close;
    if (@menu == 2) Zeny -= .@p;
    if (@menu == 3) delitem .alt, .@q * 2;
    start();
    return;
}

OnTouch:
    if (@pachua) running();
    end;

OnInit:
    .distance = 4;
    .sex = G_MALE;
    .price = 320;
    .alt = TonoriDelight;
    end;
}