summaryrefslogtreecommitdiff
path: root/npc/042-10/ctrl.txt
blob: dc249b518f97f5a9a8a556e46a854ddbd2dd9576 (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
// TMW 2 Script
// Author:
//  Jesusalva
//  Micksha
// Description:
//  Controls the great hall

// None of the exits work
042-10,86,139,0	script	#KDoor04210a	NPC_HIDDEN,3,0,{
    end;

OnTouch:
    .@g=getcharid(2);
    if (.@g < 1) percentheal -100, -100;
    dispbottom l("OH NOES! The ceiling seems to have collapsed. I hope we got the key, or the quest is over for us!");
    end;
}

042-10,149,136,0	duplicate(#KDoor04210a)	#KDoor04210b	NPC_HIDDEN,0,0
042-10,21,139,0	duplicate(#KDoor04210a)	#KDoor04210c	NPC_HIDDEN,2,0
042-10,20,80,0	duplicate(#KDoor04210a)	#KDoor04210d	NPC_HIDDEN,0,6


// Boss Room control
042-10,142,20,0	script	#KDoor04210e	NPC_HIDDEN,4,0,{
    end;

OnTouch:
    .@g=getcharid(2);
    if (.@g < 1) percentheal -100, -100;
    if (!($KAMELOT_QUEST[.@g] & 8) || !($KAMELOT_QUEST[.@g] & 16) || !($KAMELOT_QUEST[.@g] & 32)) goto L_NoAccess;
    warp "042-11@"+.@g, 41, 56;
    // TODO Fire Events
    end;

L_NoAccess:
    dispbottom l("This door is locked, if we only had a %s...", getitemlink(KamelotKey));
    end;
}

// Boss Room Warning
042-10,150,25,0	script	Warning#Kamelot	NPC_HIDDEN,{
    mesc ".:: "+l("DANGER!")+" ::.", 1;
    mes "";
    mesc l("I've sealed a massive amount of dark magic here."), 1;
    mesc l("Do not break my seal to prevent the curse from reaching Kamelot."), 1;
    mes "";
    mes l("-- Merlin");
    end;
OnInit:
    .distance=4;
    end;
}

// Magic Seal Main
042-10,135,42,0	script	#KamelotSeal	NPC_HIDDEN,0,4,{
    end;

OnTouch:
    .@g=getcharid(2);
    if (.@g < 1) percentheal -100, -100;
    if (!($KAMELOT_QUEST[.@g] & 16) && !($KAMELOT_QUEST[.@g] & 8)) goto L_NoAccessBlock;
    if (!($KAMELOT_QUEST[.@g] & 16) || !($KAMELOT_QUEST[.@g] & 8)) goto L_NoAccess;
    // You can pass freely, so we do nothing
    end;

L_NoAccess:
    slide 127, 36;
    percentheal -5, -5;
    dispbottom l("A powerful magic seal repeals you!");
    dispbottom l("It's weaker than before, probably only one is working right now.");
    end;

L_NoAccessBlock:
    slide 127, 36;
    percentheal -10, -10;
    dispbottom l("A powerful magic seal repeals you!");
    dispbottom l("We need to find what powers these two seals and disable it.");
    end;
}

////////////////////////////////////////////////////////////////////
// TODO: Catazuli spots
// TODO: Spawn monsters

042-10,128,85,0	script	#Katazuli01	NPC_SUMMONING_CIRC,0,0,{
    dispbottom l("This is probably related to the magical seals.");
    end;

OnInit:
    .distance=2;
    end;

OnTouch:
    npctalk l("TODO FIXME"); // TODO FIXME
    end;
}

042-10,32,108,0	script	#Katazuli02	NPC_SUMMONING_CIRC,0,0,{
    dispbottom l("This is probably related to the magical seals.");
    end;

OnInit:
    .distance=2;
    end;

OnTouch:
    npctalk l("TODO FIXME"); // TODO FIXME
    end;
}

////////////////////////////////////////////////////////////////////
// KamelotSwitch( "_SWITCH ID" )
function	script	KamelotSwitch	{
    // Extract ID
    .@n$=getarg(0, "_0");
    explode(.@ni$, .@n$, "_");
    .@id=atoi(.@ni$[1]);
    if (.@id <= 0) Exception("Unparseable switch: "+.@n$, RB_DEFAULT|RB_ISFATAL);

    .@g=getcharid(2);
    if (!($KAMELOT_KEYMASK[.@g] & $KAMELOT_KEY[.@g])) end; // Don't care
    .@st=($KAMELOT_PASSMASK[.@g] & .@id);
    mes l("Status: %s", (.@st ? col(l("Active"),2) : col(l("Inactive"),1) ));
    if (!countitem(KamelotKey))
        close;
    mes "Change switch status?";
    next;
    if (askyesno() == ASK_YES) {
        $KAMELOT_PASSMASK[.@g]=$KAMELOT_PASSMASK[.@g]^.@id;
        // The meaning of st is now mixed
        if (.@st)
            setnpcdisplay instance_npcname(.name$), NPC_SWITCH_OFFLINE;
        else
            setnpcdisplay instance_npcname(.name$), NPC_SWITCH_ONLINE;
    }
    // Check password and delete key
    if ($KAMELOT_PASSMASK[.@g] == $KAMELOT_PASSCODE[.@g]) {
        delitem KamelotKey, 1;
        $KAMELOT_QUEST[.@g]=$KAMELOT_QUEST[.@g]|32;
        mesc l("Your hear a clink, and the key breaks."), 2;
        // Player Reward for completing this stage
        getitem GuildCoin, 1;
        getexp $KAMELOT_MX[.@g]*50, $KAMELOT_MX[.@g]*10;
        // Guild Reward for completing this stage
        .@ggp=1200+$KAMELOT_MX[.@g]*10;
        .@gxp=$KAMELOT_MX[.@g]*25;
        $GUILD_BANK[.@g]+=.@ggp;
        guildgetexp(.@gxp); // 25xp per player average level (max 2500/3750)
        // Announce
        mapannounce getmap(), strcharinfo(0)+" has opened the gate!", 0;
        // Guild Master Notification
        .@gm$=getguildmaster(.@g);
        if (!getcharid(3, .@gm$)) return;
        .@gma=getcharid(3, .@gm$);
        .@gmb=getcharid(0, .@gm$);
        if (!isloggedin(.@gma, .@gmb)) return;
        message .@gm$, strcharinfo(0)+" opened the gate: Guild GP +"+.@ggp+" Guild XP +"+.@gxp;

    }
    return;
}

// Switches hints
// TODO: NPC_PAPER_NOTE sprite
042-10,97,126,0	script	#K4210Note01	NPC_SWORDS_SIGN,{
    .@g=getcharid(2);
    if (!($KAMELOT_KEYMASK[.@g] & $KAMELOT_KEY[.@g])) end; // Don't care
    if ($KAMELOT_PASSCODE[.@g] & 1)
        dispbottom l("There is power on the north");
    else
        dispbottom l("The north sleeps.");
    end;

OnInit:
    .distance=4;
    end;
}
042-10,139,98,0	script	#K4210Note02	NPC_SWORDS_SIGN,{
    .@g=getcharid(2);
    if (!($KAMELOT_KEYMASK[.@g] & $KAMELOT_KEY[.@g])) end; // Don't care
    if ($KAMELOT_PASSCODE[.@g] & 2)
        dispbottom l("There is power on the south");
    else
        dispbottom l("The south sleeps.");
    end;

OnInit:
    .distance=4;
    end;
}
042-10,127,45,0	script	#K4210Note04	NPC_SWORDS_SIGN,{
    .@g=getcharid(2);
    if (!($KAMELOT_KEYMASK[.@g] & $KAMELOT_KEY[.@g])) end; // Don't care
    if ($KAMELOT_PASSCODE[.@g] & 1)
        dispbottom l("There is power on the west");
    else
        dispbottom l("The west sleeps.");
    end;

OnInit:
    .distance=4;
    end;
}
042-10,33,133,0	script	#K4210Note08	NPC_SWORDS_SIGN,{
    .@g=getcharid(2);
    if (!($KAMELOT_KEYMASK[.@g] & $KAMELOT_KEY[.@g])) end; // Don't care
    if ($KAMELOT_PASSCODE[.@g] & 8)
        dispbottom l("There is power on the east");
    else
        dispbottom l("The east sleeps.");
    end;

OnInit:
    .distance=4;
    end;
}
042-10,38,39,0	script	#K4210Note16	NPC_SWORDS_SIGN,{
    .@g=getcharid(2);
    if (!($KAMELOT_KEYMASK[.@g] & $KAMELOT_KEY[.@g])) end; // Don't care
    if ($KAMELOT_PASSCODE[.@g] & 16)
        dispbottom l("There is power on the maze");
    else
        dispbottom l("The maze sleeps.");
    end;

OnInit:
    .distance=4;
    end;
}

// The "_" is used on explode
042-10,89,28,0	script	#K4210Switch_1	NPC_SWITCH_OFFLINE,{
    KamelotSwitch(strnpcinfo(0, "_0"));
    close;

OnInit:
    .distance=2;
    end;
}

// Other switches
042-10,80,115,0	duplicate(#K4210Switch_1)	#K4210Switch_2	NPC_HIDDEN,0,0 // S
042-10,63,76,0	duplicate(#K4210Switch_1)	#K4210Switch_4	NPC_HIDDEN,0,0 // W
042-10,100,79,0	duplicate(#K4210Switch_1)	#K4210Switch_8	NPC_HIDDEN,0,0 // E
042-10,82,64,0	duplicate(#K4210Switch_1)	#K4210Switch_16	NPC_HIDDEN,0,0 // C