summaryrefslogtreecommitdiff
path: root/npc/001-3-0/gates.txt
blob: e8accc96b331446517f87eb67a197d5ca021f941 (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
// Evol scripts.
// Author:
//    Micksha
// Description:
//    The Sewer Gates, and Wheels.

001-3-0,90,62,0	script	#ArtisThiefGate_1	NPC_SEWER_GATE,0,0,{
    // Extract the quest ID from name (or fail trying)
    explode(.@ni$, .name$, "_");
    .@id=atoi(.@ni$[1]);

    .@q=getq(ThiefQuests_Artis);
    .@q2=getq2(ThiefQuests_Artis);

    // Check what you can do with the gate
    if (.@q != .@id) {
        mes l("This gate is closed.");
        mesc l("No need to go through here, so lets not bother with it now.");
    } else if (.@q2 != 2) {
        mes l("This gate is closed.");
        mesc l("It seems that it can be open using the mechanism on the side.");
    } else {
        mes l("This gate is open.");
        mesc l("I should still be careful to don't get caught.");
    }
    close;

OnTouch:
    updateSpotlight(true);
    end;

OnOpenSesame:
    // Opening
    if (!.busy) {
        .dir=2;
        .busy=true;
        initnpctimer;
    }
    end;

// Open
OnTimer2200:
    .dir=4;
    end;

// Closing
OnTimer8000:
    .dir=6;
    end;

// Closed
OnTimer10400:
    .dir=0;
    end;

// Don't reply immediately, wait a tiny bit
OnTimer11000:
    .busy = false;
    stopnpctimer;

OnInit:
    .busy = false;
    .distance = 1;
    end;
}



001-3-0,92,61,0	script	#ArtisThiefWheel_1	NPC_SEWER_WHEEL,{
    // Extract the quest ID from name (or fail trying)
    explode(.@ni$, .name$, "_");
    .@id=atoi(.@ni$[1]);

    .@q=getq(ThiefQuests_Artis);
    .@q2=getq2(ThiefQuests_Artis);

    if (.@q != .@id) {
        speech
            l("This wheel seems to be connected to the locked gate on the side."),
            l("Having to reason to tinker with it, you don't.");
        close;
    }
    speech
        l("You try to move this wheel, but it is stuck. Something seems to be missing."),
        l("Maybe some monster ate it, but what would be big enough to do that?!");

    // Switch gearwheel status: 1(looted) 2(unlooted)
    switch (.@q2) {
    case 1:
        // Looted but lost? D:
        if (!countitem(Gearwheel)) {
            mesc l("If we only had a %s.", getitemlink(Gearwheel));
            close;
        }

        // Prompt player
        mesc l("Should we install the %s and move it?", getitemlink(Gearwheel)), 1;
        if (askyesno() == ASK_NO)
            break;

        delitem Gearwheel, 1;
        setq2 ThiefQuests_Artis, 2;
        // FALLTHROUGH
    case 2:
        mesc l("With the %s in place, it only takes a bit more effort to make it budge.", getitemlink(Gearwheel));
        next;
        closeclientdialog;
        // Spin the wheel
        if (!.busy) {
            .dir = 4;
            .busy = true;
            initnpctimer;
        }
        // Open the gate
        addtimer 500, "#ArtisThiefGate_"+.@id+"::OnOpenSesame";
        break;
    default:
    }
    close;

// Done spinning?
OnTimer4000:
    .dir = 0;
    .busy = false;
    stopnpctimer;

OnInit:
    .busy = false;
    .distance = 2;
    end;
}



// We're missing a gate!
001-3-0,56,44,0	duplicate(#ArtisThiefGate_1)	#ArtisThiefGate_4	NPC_SEWER_GATE,2,2
001-3-0,58,43,0	duplicate(#ArtisThiefWheel_1)	#ArtisThiefWheel_4	NPC_SEWER_WHEEL


///////////////////////////
// The controlled warps
001-3-0,90,61,0	script	#001-3-0_90_61	NPC_HIDDEN,0,0,{
    end;

OnTouch:
    // No enter except when q1 and q2 matches
    .@q=getq(ThiefQuests_Artis);
    .@q2=getq2(ThiefQuests_Artis);
    if (.@q != 1 || .@q2 != 2)
        end;

    // Delete previous timers. Makes easier to cheat but more reliable (FIXME)
    deltimer("#ArtisThiefBook_0::OnBust1");
    deltimer("#ArtisThiefBook_0::OnBust2");
    deltimer("#ArtisThiefBook_0::OnBust3");
    deltimer("#ArtisThiefBook_0::OnBust4");

    // Archives: Begin
    addtimer 30000, "#ArtisThiefBook_0::OnBust1";
    warp "001-2-43", 51, 34;
    end;
}

001-3-0,56,43,0	script	#001-3-0_56_43	NPC_HIDDEN,0,0,{
    end;

OnTouch:
    // No enter except when quest state allows you to
    // I thought in letting you use this passage and get busted anytime...
    // ...........Better not. Animation will not like it, anyway.
    .@q=getq(ThiefQuests_Artis);
    .@q2=getq2(ThiefQuests_Artis);
    if (.@q != 4 || .@q2 != 2)
        end;

    warp "001-2-40", 56, 40;
    addtimer2(rand2(3000, 7000), .name$+"::OnBusted");
    end;

// Henry said to you don't use the gate, because you are not discrete enough.
// Poor player, this is what happens for not paying attention to Henry's advise.
OnBusted:
    if (getmap() != "001-2-40")
        end;

    mesn l("Legion Officer");
    mes l("HEY! How you got here!?");
    next;
    // Check if you'll be caught
    if (ArrestedChances()) {
        mesc l("Arrested!");
        mesc l("You'll now spend a few minutes on the jail to reflect on your actions.");
        ArrestPlayer(5);
    } else {
        mesc l("You're almost found out, but manage to make a quick escape!");
        warp "001-1", 41, 36;
    }
    close;
}