summaryrefslogtreecommitdiff
path: root/npc/001-1/salem.txt
blob: b80cb76e4bab25a364e5cd5ee152df01e081feb6 (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
// Evol scripts.
// Author:
//    Travolta
// Description:
//    Trader on the market. One of his pious escaped and
//    flies around the town.
// Variables:
//    ArtisQuests_CatchPiou   -- quest variable
// Quest states:
//    0  -- not started
//    1  -- trader asked to catch piou
//    2  -- quest finished
// Note: this script is ugly like hell

001-1,57,118,0	script	Salem#001-1	NPC_SALEM,{

    function BuyPiou {
        .@price = getarg(0);
        mesq l("The piou costs @@ E.", .@price);
        next;
        select
            l("Alright, I'll take one."),
            l("I changed my mind.");

        mes "";
        mesn;
        if (@menu == 2)
            return 4;
        if (Zeny < .@price)
        {
            mesq l("Don't you try to cheat an old merchant! You don't have enough money, you need @@ E.", .@price);
            next;

            return 1;
        }
        if (!checkweight(PiouEgg, 1))
        {
            mesq l("You can't carry another @@? What a shame.", PiouEgg);
            next;

            return 2;
        }
        getinventorylist;
        if (.@inventorylist_count >= 100)
        {
            mesq l("You don't have enough room in your backpack for a @@. Go stow some of your junk and come back.", PiouEgg);
            next;

            return 3;
        }
        Zeny = Zeny - .@price;
        getitem PiouEgg, 1;
        ArtisQuests_PiousBought += 1;
        mesq l("You take good care of your piou. Remember to feed it every day.");

        return 0;
    }

//    if (2 == select("[debug]continue quest:[debug] start over"))
//    {
//        debugmes "Starting quest CatchPiou over";
//        setq ArtisQuests_CatchPiou, 0;
//    }

    .@q = getq(ArtisQuests_CatchPiou);
    @ArtisQuests_PiouPrice = 30000;

    if (.@q == 1)
    {
        if (.PiouCaught)
        {
        speech
            l("Look who is back..."),
            l("And with my piou. That's wonderful. I can only imagine how hard that little bugger was to catch!"),
            l("Great, and as I promised, I give you a 90% discount on the @@ of your choice.", getitemlink(PiouEgg));
            next;

            @ArtisQuests_PiouPrice = 3000;
            ArtisQuests_PiouDiscount = 1;
            donpcevent strnpcinfo(3) + "::OnPiouFlee";
            setq ArtisQuests_CatchPiou, 2;
            .@q = getq(ArtisQuests_CatchPiou);

            .LastPiouHunter$ = "";
            ArtisQuests_CatchPiou_Difficulcy = 0;
            .@BoughtPiou = BuyPiou(@ArtisQuests_PiouPrice);
            if (.@BoughtPiou == 0)
                ArtisQuests_PiouDiscount = 0;
            else if (.@BoughtPiou == 4)
                speech S_FIRST_BLANK_LINE, l("See you next time!");

            close;
        }
        else
        {
            speech
                l("Look who is back..."),
                l("So, where is my piou? You should not keep an old man waiting. Go and catch it like you said you would.");
                next;
            goto L_SalemMenuShop;
        }
    }

    speech S_LAST_NEXT,
        l("Good day, my friend, come closer, come closer!");
        l("Just look at my goods for sale! Fresh fruits and vegetables were shipped only this morning. And for reasonable price, of course.");

L_SalemMenuShop:
    .@fexil = getq(ArtisQuests_Fexil);

    select
        l("What about those pious? They look so cute."),
        l("Let's trade."),
        rif(.@q != 0, l("I'd like to buy a piou.")),
        rif(.@fexil == 1, l("I'm looking for somebody named Fexil.")),
        menuaction(l("Quit"));

    switch (@menu)
    {
        case 1:
            goto L_AboutPious;
            break;
        case 2:
            closedialog;
            shop "Store#General001-1";
            close;
        case 3:
            if (.@q == 2 && ArtisQuests_PiouDiscount)
            {
                speech S_FIRST_BLANK_LINE | S_LAST_NEXT,
                    l("You still have a 90% discount on one piou.");
                @ArtisQuests_PiouPrice = 3000;
            }
            if (!BuyPiou(@ArtisQuests_PiouPrice))
                ArtisQuests_PiouDiscount = 0;
            break;
        case 4:
            speech S_FIRST_BLANK_LINE | S_LAST_NEXT,
                l("I think that I've seen this weakling wandering around the beach south from here this morning.");
            break;
    }

    closedialog;
    goodbye;
    close;

L_AboutPious:
    speech S_FIRST_BLANK_LINE | S_LAST_NEXT,
        l("Ah, the locals like keeping them as pets.");
        l("With proper training, a piou can become a good friend and faithful companion in your adventures.");

    if (getq(ArtisQuests_CatchPiou) >= 2)
    {
        goto L_SalemMenuShop;
    }

    mesq l("Their price is usually high, but you know what? I have a bargain offer for you.");
    next;
    mesq l("These little pious here can't fly. At least that's what I thought.");
    next;
    mesq l("One of these little boogers started flying early, and escaped from me.");
    next;
    mesq l("It's still too young to fly too far away, so it just circles nearby.");
    next;
    mesq l("But I can't leave to catch it, so I'm asking you.");
    next;
    mesq l("If you catch the escaped piou and bring it back, I will give you a 90% discount on a piou.");
    next;

    select
        rif(.@q == 0, l("Sounds like a good deal to me. I'll do it.")),
        rif(.@q == 1, l("I'm on my way! I will bring it back to you.")),
        l("I don't really have time to go chasing pious, let me just buy one at the regular price (30000 E)."),
        l("I don't want to buy a piou right now.");

    mes "";
    mesn;

    switch (@menu)
    {
        case 1:
            goto L_QuestInfo;
        case 3:
            BuyPiou @ArtisQuests_PiouPrice;
    }
    closedialog;
    goodbye;
    close;

L_QuestInfo:
    mesq l("The little piou is flying nearby, all you need is to catch it and bring back to me.");
    next;
    setq ArtisQuests_CatchPiou, 1;
    ArtisQuests_CatchPiou_Difficulcy = 2;
    mesq l("Good luck!");
    close;

OnPiouFlee:
    sleep 120000;
    if (!.PiouCaught)
        end;
    .PiouCaught = 0;
    .@piou$ = "#FlyingPiou1";
    if (getstrlen(.LastPiouHunter$) > 0)
    {
        message .LastPiouHunter$, .PiouEscapedMessage$;
        .LastPiouHunter$ = "";
    }
    // debugmes "The piou escaped from " + .LastPiouHunter$;
    sleep 60000;
    enablenpc .@piou$;
    movenpc .@piou$, 53, 117;
    donpcevent .@piou$ + "::OnInit";
    end;

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