summaryrefslogtreecommitdiff
path: root/npc/001-1/salem.txt
blob: 3a37862088491479b5d821b5ae15e2d4226b73ec (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
// 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;
        menuint l("Alright, I take it."), 1,
                l("I changed my mind."), 2;

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

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

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

            return 3;
        }
        Zeny = Zeny - .@price;
        getitem 4000, 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 0,
            l("Look who is back..."),
            l("And with my piou! That's wonderful, I can't think at how hard that was to catch it."),
            l("Great, you get your piece of cake, I give you a 90% discount on the @@ of your choice.", getitemlink (4000));
            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 1, l("See you next time!");

            close;
        }
        else
        {
            speech 0,
                l("Look who is back..."),
                l("So, where is my piou? You should keep the given promise.");
                next;
            goto L_SalemMenuShop;
        }
    }

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


L_SalemMenuShop:
    menuint
        rif(.@q < 2, l("What about those pious? They look so cute.")), 0,
        rif(.@q != 0, l("I'd like to buy a piou.")), 1,
        l("I'd like to see your other products."), 2;

    mes "";
    mesn;
    
    switch (@menuret)
    {
        case 0:
            goto L_AboutPious;
        case 1:
            if (.@q == 2 && ArtisQuests_PiouDiscount)
            {
                mesq l("You still have a 90% discount on one piou");
                @ArtisQuests_PiouPrice = 3000;
                next;
            }
            if (!BuyPiou(@ArtisQuests_PiouPrice))
                ArtisQuests_PiouDiscount = 0;
            next;
            mesq l("See you next time!");
            close;
        case 2:
            goto L_BuyShop;
    }

L_AboutPious:
    mesq l("Ah, these... Citizens like buying them as pets.");
    next;
    mesq l("With proper training, a piou can become a good friend and faithful companion in your adventures.");
    next;
    mesq l("Their price is usually high, but you know what? You have a lucky day.");
    next;
    mesq l("These little pious here can't fly. At least that's what I thought.");
    next;
    mesq l("One of these little bastards 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;

    menuint rif (.@q == 0, l("Sounds like easy money. I'll do it.")), 0,
            rif (.@q == 1, l("I'm on my way to bring it back to you!")), 1,
            l("I don't really have time to chase pious, let me just buy one for it's real price (30000E)."), 2,
            l("I don't want to buy a piou right now."), 3;
            
    mes "";
    mesn;

    switch (@menuret)
    {
        case 0:
            goto L_QuestInfo;
        case 1:
            mesq l("Alright, see you later then!");
            close;
        case 2:
            BuyPiou @ArtisQuests_PiouPrice;
            mesq l("See you later!");
            close;
        case 3:
            mesq l("See you later!");
            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;

L_BuyShop:
    mes "not implemented yet!";
    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:
    setnpcsex G_MALE;
    setnpcdistance 5;
    end;
}