summaryrefslogtreecommitdiff
path: root/npc/014-2-2/valia.txt
blob: c4911307e8986eec6d8ec38ce81d68c5083fdcef (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
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Gemini Sisters Quest - Valia Gemini. The quest can be resumed within 4 hours.

034-1	mapflag	zone	MMO
034-2	mapflag	zone	MMO
034-3	mapflag	zone	MMO
034-4	mapflag	zone	MMO

// Check if you can do this action or not (hero)
function	script	GeminiCheck	{
    .@st = getarg(0, 0);
    if (getq(General_Narrator) < 16 || @mystatus < .@st) {
        warp "Save", 0, 0;
        dispbottom l("You don't feel so well... And then, you're dead.");
        die();
        end;
    }
    return;
}

// You killed a mob
function	script	GeminiKill	{
    if (!compare(getmap(), "val")) end;
    .@p=getcharid(1);
    switch ($@VALIA_STATUS[.@p]) {
    case 2: // Looking for a runestone
        if (killedrid == GreenSlime) {
            if (!rand2(40) || $@GM_OVERRIDE) {
                getexp 8132, 657;
                dispbottom l("You found the Runestone! You gave it to the party leader.");
                $@VALIA_STATUS[.@p] = 3;
            }
        }
        break;
    case 4: // Desert unlocked, but no clue on what to do
    case 5: // Desert unlocked, cutscene over
        debugmes "Killedrid = %d = Cave Snake = %d", killedrid, CaveSnake;
        if (killedrid == CaveSnake) {
            if (!rand2(4) && countitem(SealedSoul) < 10) {
                getitem SealedSoul, 1;
                areamonster(getmap(), 100, 20, 170, 60, strmobinfo(1, MagicGoblin), MagicGoblin, 1, "Valia::OnMGoblin");
            }
        }
        break;
    case 6: // Just entered the Den
        break;
    case 7: // Just got stunned
        break;
    // Forest -> Desert -> Bandit Cave -> Island -> Fake showdown -> Storage -> Showdown -> Chest, Lore and Exit -> Wumpus' Trap -> End
    }
    return;
}

// Valia Gemini
014-2-2,36,22,0	script	Valia	NPC_RED_WIZARD_F,{
    GeminiCheck();
    .@q = getq(HurnscaldQuest_Gemini);
    .@t = getq3(HurnscaldQuest_Gemini);
    mesn;
    mesq l("Greetings, adventurer. I am Valia Gemini, owner of this abode.");
    // If your level is too low (just reborn), it could break scripts
    // So close dialog here.
    if (BaseLevel < 30) close;
    next;
    if (getcharid(1) >= 1) {
        if (($@VALIA_STATUS[getcharid(1)] >= 16) &&
            (gettimetick(2) < (.@t + 14400))) {
            mesn;
            mesq l("You are welcome here, but don't overstay your welcome and leave as soon as possible.");
            mesc l("Please wait %s before trying again.", FuzzyTime(.@t + 14400));
            close;
        }
    }
    mesn;
    mesq l("I usually don't let anyone in, but I had to make an exception for the likes of you.");
    next;
    mesn;
    mesq l("You see, I have a sister. Luvia Gemini. Very talented, but unfortunately, not enough to prevent being captured and brainwashed by Isbamuth.");
    next;
    mesn;
    mesq l("I am sure you already fought him. And survived, too, apparently. Help her, and I will reward your efforts appropriately.");
    next;
    mesn;
    mesq l("You can bring up to %d other friends with you, but they must be on the same party and map as you and you must be the party leader.", ($EVENT$ == "Gemini" ? 5 : 3));
    if (gettimetick(2) < (.@t + 14400))
        mesc l("The previous attempt will be resumed."), 1;
    next;
    select
        l("I'm not interested, sorry."),
        l("Why don't you go yourself?"),
        l("Alright, I will help.");
    mes "";
    switch (@menu) {
    case 1:
        close;
    case 2:
        mesn;
        mesq l("Because Isbamuth is tracking me? It would be pointless if he noticed. If you can't even understand this, maybe I overestimated you, after all...");
        close;
    }
    // You accepted the quest
    mesn;
    // ...But you lack a party
    if (getcharid(1) <= 0) {
	    mesq l("You don't have a party. You're useless to me.");
        tutmes l("You can make a party of 1 if you want to do it alone. This, however, is NOT ADVISED."), "Protip", false;
        close;
    }
    // ...But you are not the leader
    if (strcharinfo(0) != getpartyleader(getcharid(1))) {
	    mesq l("Bring me %s or make your own party if you want to help me.", getpartyleader(getcharid(1)));
        close;
    }
    // ...But the party is too large
    getpartymember(getcharid(1));
	.@count = $@partymembercount;
    // The amount varies based on the season
    if (.@count > ($EVENT$ == "Gemini" ? 6 : 4)) {
	    mesq l("Your party is too big. Discretion is a key if we want to succeed.");
        close;
    }
    // Alright.
    mesq l("Good. I hope you have stocked everything. The time limit is 4 hours.");

    // Only first attempt is free - all others are charged
    if ($EVENT$ != "Gemini" ||
        ($EVENT$ == "Gemini" && GEMINI_DAY == gettime(5)))
    {
        if (getq(HurnscaldQuest_Gemini) && !is_gm()) {
            next;
            mesn;
            mesq l("Actually, I need help with reagents this time. Bring me a %s and a %s and I'll gladly warp you... again.", getitemlink(GemPowder), getitemlink(EverburnPowder));
            if (!countitem(GemPowder) || !countitem(EverburnPowder)) close;
            next;
        }
    }
    mesc l("Are you and your party ready?"), 1;
    if (askyesno() != ASK_YES)
        close;

    // Not eligible for free lunch
    if ($EVENT$ != "Gemini" ||
        ($EVENT$ == "Gemini" && GEMINI_DAY == gettime(5)))
    {
        if (getq(HurnscaldQuest_Gemini) && !is_gm()) {
            delitem GemPowder, 1;
            delitem EverburnPowder, 1;
        }
    } else if ($EVENT$ == "Gemini") {
        GEMINI_DAY = gettime(5);
    }

    // Handle first attempt
    clear;
    mesn;
    mesq l("Good. Here, take this key and hide it. I will quickly brief you:");
    mes "";
    mesc l(".:: GEMINI ASSASSINS QUEST ::."), 3;
    mesc l("Recommended Level: %d+", 85);
    mes "";
    mes l("- The goal is to rescue Luvia from Isabamuth. She has been ##Bbrainwashed##b.");
    mes l("- Luvia is a powerful mage and Isbamuth is watching, so teleporting directly would be risky.");
    mes l("- Instead, the party will be teleported ##Bto a forest.##b");
    mes l("- Find a path to the island where she is hiding herself!");
    if (!getq(HurnscaldQuest_Gemini))
        mesc l("- If you fail, you'll need to pay me ingredients to try again!"), 1;
    mes "";
    mesc l("Good luck!");
    next;
    closeclientdialog;

    compareandsetq HurnscaldQuest_Gemini, 0, 1;
    setq3 HurnscaldQuest_Gemini, gettimetick(2);

    // Create instance
    .@p=getcharid(1);
	.@inst = instance_create("Gemini "+.@p, .@p, IOT_PARTY);

    // If it worked then setup
    if (.@inst >= 0) {
        // Attach maps
        instance_attachmap("034-1", .@inst, false, "val1@"+.@p);
        instance_attachmap("034-2", .@inst, false, "val2@"+.@p);
        instance_attachmap("034-3", .@inst, false, "val3@"+.@p);
        instance_attachmap("034-4", .@inst, false, "val4@"+.@p);
        // Save the instance ID
        $@VALIA_STATUS[.@p]=0;
        $@VALIA_INST[.@p]=.@inst;
        $@VALIA_MAP$[.@p]="";
    }

    // Instance lasts 4 hours - your time limit
	instance_set_timeout(14400, 14400, $@VALIA_INST[.@p]);

    // Do we need to initialize or are we just restarting?
    if (.@inst >= 0)
    	instance_init(.@inst);

    // Warp everyone and add timers
    partytimer("014-2-2", 10, "#Gemini::OnCoreInit", getcharid(1));
    sleep2(100);
    warpparty("val1@"+.@p, 24, 24, getcharid(1), "014-2-2", true);
    close;

// Macros
OnGSlime:
    fix_mobkill(GreenSlime);
    .@p = getcharid(1);
    areamonster("val1@"+.@p, 20, 20, 60, 60, strmobinfo(1, GreenSlime), GreenSlime, 1, "Valia::OnGSlime");
    end;

OnLHead:
    fix_mobkill(LogHead);
    .@p = getcharid(1);
    areamonster("val1@"+.@p, 20, 20, 70, 60, strmobinfo(1, LogHead), LogHead, 1, "Valia::OnLHead");
    end;

OnFShroom:
    fix_mobkill(ForestMushroom);
    .@p = getcharid(1);
    areamonster("val1@"+.@p, 20, 20, 70, 60, strmobinfo(1, ForestMushroom), ForestMushroom, 1, "Valia::OnFShroom");
    end;

OnRShroom:
    fix_mobkill(RedMushroom);
    .@p = getcharid(1);
    areamonster("val1@"+.@p, 20, 20, 70, 60, strmobinfo(1, RedMushroom), RedMushroom, 1, "Valia::OnRShroom");
    end;

///////////////////////////////////
OnCSnake:
    fix_mobkill(CaveSnake);
    .@p = getcharid(1);
    areamonster("val1@"+.@p, 100, 20, 170, 60, strmobinfo(1, CaveSnake), CaveSnake, 1, "Valia::OnCSnake");
    end;

OnMGoblin:
    fix_mobkill(MagicGoblin);
    .@p = getcharid(1);
    if (mobcount("val1@"+.@p, "Valia::OnMGoblin") > getmapusers("val1@"+.@p) * 50)
        end;
    areamonster("val1@"+.@p, 100, 20, 170, 60, strmobinfo(1, MagicGoblin), MagicGoblin, 1, "Valia::OnMGoblin");
    // Spawn a high precision one as well
    .@mg=areamonster("val1@"+.@p, 100, 20, 170, 60, strmobinfo(1, MagicGoblin), MagicGoblin, 1, "Valia::OnMGoblin");
    setunitdata(.@mg, UDT_HIT, 42 + mobcount("val1@"+.@p, "Valia::OnMGoblin") * 2);
    end;

///////////////////////////////////
OnKey1:
    .@p = getcharid(1);
    @tmp+=1;
    sleep2(rand2(1000, 3000) + (@tmp*300)); // Prevent outright farming
    .@mob=monster("val2@"+.@p, 57, 104, strmobinfo(1, CopperSlime), CopperSlime, 1, "Valia::OnKey1");
    // This should wipe the monster experience value
    setunitdata(.@mob, UDT_LEVEL, 1);
    if (countitem(Lockpicks) || @lockpicks || rand2(3)) end;
    getitem Lockpicks, 1;
    @lockpicks=true;
    end;

OnKey2:
    .@p = getcharid(1);
    @tmp+=1;
    sleep2(rand2(1000, 3000) + (@tmp*300)); // Prevent outright farming
    .@mob=monster("val2@"+.@p, 61, 104, strmobinfo(1, CopperSlime), CopperSlime, 1, "Valia::OnKey2");
    // This should wipe the monster experience value
    setunitdata(.@mob, UDT_LEVEL, 1);
    if (countitem(Lockpicks) || @lockpicks || rand2(3)) end;
    getitem Lockpicks, 1;
    @lockpicks=true;
    end;

OnKey3:
    .@p = getcharid(1);
    @tmp+=1;
    sleep2(rand2(1000, 3000) + (@tmp*300)); // Prevent outright farming
    .@mob=monster("val2@"+.@p, 66, 104, strmobinfo(1, CopperSlime), CopperSlime, 1, "Valia::OnKey3");
    // This should wipe the monster experience value
    setunitdata(.@mob, UDT_LEVEL, 1);
    if (countitem(Lockpicks) || @lockpicks || rand2(3)) end;
    getitem Lockpicks, 1;
    @lockpicks=true;
    end;

OnLord:
    .@p = getcharid(1);
    if (!mobcount("val2@"+.@p, "Valia::OnLord")) {
        $@VALIA_STATUS[.@p] = 8;
        Zeny+=15000;
        dispbottom l("This lord dropped a key and a stash of gold!");
    }
    end;

OnInit:
    .distance=4;
    end;
}