OSDN Git Service

First version
[st-ro/stro.git] / npc / custom / etc / quest_warper.txt
1 //===== rAthena Script ============================================
2 //= Quest Warper Script
3 //===== By: =======================================================
4 //= DZeroX, Darkchild, Neouni
5 //===== Current Version: ==========================================
6 //= 2.3
7 //===== Compatible With: ==========================================
8 //= rAthena Project
9 //===== Description: ==============================================
10 //= Warper that works only after locations are unlocked.
11 //===== Additional Comments: ======================================
12 //= 1.0 - NPCs created
13 //= 1.1 - Add Dungeons by sturm
14 //= 1.2 - Add All char in account unlocked by ace_killer
15 //= 1.3 - Add new 7 towns and 7 dungeons by escoteiro
16 // - Correct bug jawaii town by escoteiro
17 // - Remove some excessive warpras by escoteiro
18 //= 1.4 - Rewrite of the Warpa system [Neouni]
19 // - Corrected some bugs caused by autoconverting the old script
20 //= 1.4a - Rewrite of menu to be custom for each player [Neouni]
21 // - Dungeon listing rewrite
22 // - Town listing rewrite
23 // - GameMaster can Customise Main menu
24 //= 1.4b - Pricing round [Neouni]
25 // - GM menu added for pricing
26 // - Town Warp pricing tags added
27 // - Dungeon Warp pricing tags added
28 //= 1.5 - storage functions pricing [Neouni]
29 // - storage pricing added
30 // - kafra points setting added
31 // - kafra storage code security added
32 // - Healing scripts pricing added
33 // - Heal Part script added
34 //= 1.6 - Dungeon warp [Neouni] (beta only)
35 // - added option to add a extra fee for going down deeper into dungeon
36 // partly by rebuilding the dungeon warping into variable menu's
37 //= 1.6a - alot of fixes for beta release [Neouni] (public release)
38 // - fixed syntax problems
39 // - fixed missing pyramid gats in @DGat$ array
40 // - removed the culver level 5 that didn't exist
41 //= 1.7 - Readability of Dungeon menu building increased [Neouni]
42 // - Thanatos Tower & Louyang Dungeon added
43 //= 1.8 - changed around unlock variables [Neouni]
44 // - Moved warp variables to mark what you have unlocked to an binary array in login based permanent variable
45 // (warp variables are saved in login database, so all charservers have these unlocked)
46 // - Town Warp unlock array max 21/(unknown max) items used instead of max account #variables 32 !
47 // - Dungeon Warp unlock array 28/(unknown max) items used instead of max account #variables 32 !
48 // - (max login ##variables = 16, i used 3)
49 // - old variables are cleared on next save
50 // - Extra Variable clear added for every character, just in case (request by Terces)
51 //= 1.8a - Show amount of users on map [Neouni]
52 //= 1.8b - Small typo fixed in stampcard script [Neouni]
53 //= 1.9 - Making it more edit friendly [Neouni]
54 // - Made Dungeon warp arrays more readable & editable (QWS_Darray)
55 // - Made town warp arrays more readable & editable (QWS_Tarray)
56 //= 2.0 - Special Warp menu added [Neouni]
57 // - when all towns and dungeons are collected a new option on the main menu will show
58 // - it will only show when you setup the mapname of the warp !
59 //= 2.0a - Dungeon Level Limit & Split dungeon fees
60 // - Limits dungeon based on Depth, access special setup menu thru GM-Menu
61 // - Dungeon fees split up based on  Basic , Advanced & Overseas
62 // - Old Dungeon fee system removed, all dungeon fees now set to 0
63 //= 2.0b - Special warpname menu option name bug fixed
64 //= 2.1 - Updated names to fall within retrictions. [L0ne_W0lf]
65 //= 2.2 - #kafra_code is now stored as is. [brianluau]
66 //= 2.3 - Added new town maps, cleanup, and removed pre-1.8 backwards fix. [Euphy]
67 //=================================================================
68
69 //========================Function=&=Script========================
70
71 function        script  Q_Warpra        {
72         mes "[Warpra]";
73         mes "Hello,";
74         mes "I can warp you to any town or dungeon, but you need to unlock them first by visiting us.";
75         mes "What do you need?";
76         
77         if(getarg(0) == 0) callfunc "QWS_MMarray",0;
78         if(getarg(0) == 1) callfunc "QWS_MMarray",1;
79         
80         set @MMenu,select(@Mmenulist$[0],@Mmenulist$[1],@Mmenulist$[2],@Mmenulist$[3],@Mmenulist$[4],@Mmenulist$[5],@Mmenulist$[6],@Mmenulist$[7],@Mmenulist$[8],@Mmenulist$[9],@Mmenulist$[10],@Mmenulist$[11]);
81
82         switch(@Mmenuref[@MMenu-1]+1){
83         case 1: goto GM_Menu;
84         case 2:
85                 warp $QW_SP_WarpMap$, $QW_SP_WarpX, $QW_SP_WarpY;
86                 close2;
87                 debugmes "Please check your special warp menu settings on the Warpra.";
88                 end;
89         case 3: goto L_town;
90         case 4: goto L_dungeon;
91         case 5: goto L_FewWarps;
92         case 6: goto L_NoUnlock;
93         case 7: goto L_heal_Full;
94         case 8: goto L_heal_Part;
95         case 9: goto L_Storage;
96         case 10: goto L_GStorage;
97         case 11:
98         default:
99                 goto L_end;
100         }
101
102 //=====================GM-Menu=Functions===========================
103
104 GM_Menu:
105         next;
106         mes "Town warping = "+(($QW_TW_OFF)?"^FF0000 Off":"^00FF00 On")+"^000000";
107         mes "Dungeon warping = "+(($QW_DW_OFF)?"^FF0000 Off":"^00FF00 On")+"^000000";
108         mes "Dungeon Depth limit is "+(($QW_DL)?"^00FF00 On":"^FF0000 Off")+"^000000";
109         mes "If on Dungeon Depth limit is set to ^0000FF"+$QW_DDL+"^000000";
110         mes "Show Map Users = "+(($QW_MapUserShow)?"^00FF00 On":"^FF0000 Off")+"^000000";
111
112         if ($QW_HF) mes "Healing full = ^00FF00 On ^000000";
113         if ($QW_HP) mes "Healing partly = ^00FF00 On ^000000";
114         if (!$QW_HF && !$QW_HP) mes "Healing = ^FF0000 Off ^000000";
115
116         mes "Storage = "+(($QW_Stor)?"^00FF00 On":"^FF0000 Off")+"^000000";
117         mes "Guild Storage = "+(($QW_GStor)?"^00FF00 On":"^FF0000 Off")+"^000000";
118         mes "Kafra points collect = "+(($QW_KPoint)?"^00FF00 On":"^FF0000 Off")+"^000000";
119
120         switch(select("Town Warping","Dungeon Warping","Dungeon Level Limit","Show Map Users","Healing full","Healing partly","Storage","Guild Storage","Kafra points collect","Set Prices","Special Warp","Exit")) {
121         case 1: set $QW_TW_OFF,($QW_TW_OFF)?0:1; goto GM_Menu;
122         case 2: set $QW_DW_OFF,($QW_DW_OFF)?0:1; goto GM_Menu;
123         case 3: goto DungeonLevelLimit;
124         case 4: set $QW_MapUserShow,($QW_MapUserShow)?0:1; goto GM_Menu;
125         case 5:
126                 if ($QW_HF == 0) {
127                         set $QW_HF,1;
128                         set $QW_HP,0;
129                 }
130                 else set $QW_HF,0;
131                 goto GM_Menu;
132         case 6:
133                 if ($QW_HP == 0) {
134                         set $QW_HP,1;
135                         set $QW_HF,0;
136                 }
137                 else set $QW_HP,0;
138                 goto GM_Menu;
139         case 7: set $QW_Stor,($QW_Stor)?0:1; goto GM_Menu;
140         case 8: set $QW_GStor,($QW_GStor)?0:1; goto GM_Menu;
141         case 9: set $QW_KPoint,($QW_KPoint)?0:1; goto GM_Menu;
142         case 10: goto Setprice;
143         case 11: goto SpecialWarpMenu;
144         default:
145                 close;
146                 end;
147         }
148
149 //======================GM-Menu=Pricing============================
150
151 Setprice:
152         if ($QW_DW_FEE != 0) set $QW_DW_FEE,0;
153         next;
154         mes "Scroll through the list to see all the options.";
155
156         mes "Basic - Warps are = "+(($QW_BW_PRICE)?"^00FF00"+$QW_BW_PRICE:"^FF0000Free")+"^000000";
157         mes "Advanced - Warps are = "+(($QW_AW_PRICE)?"^00FF00"+$QW_AW_PRICE:"^FF0000Free")+"^000000";
158         mes "Overseas - Warps are = "+(($QW_OW_PRICE)?"^00FF00"+$QW_OW_PRICE:"^FF0000Free")+"^000000";
159
160         mes "Basic Dungeon level warp fee = "+(($QW_BW_FEE)?"^00FF00"+$QW_BW_FEE:"^FF0000NO")+"^000000 zeny per level";
161         mes "Advanced Dungeon level warp fee = "+(($QW_AW_FEE)?"^00FF00"+$QW_AW_FEE:"^FF0000NO")+"^000000 zeny per level";
162         mes "Overseas Dungeon level warp fee = "+(($QW_OW_FEE)?"^00FF00"+$QW_OW_FEE:"^FF0000NO")+"^000000 zeny per level";
163
164         mes "Full Healing = "+(($QW_HF_PRICE)?"^00FF00"+$QW_HF_PRICE:"^FF0000Free")+"^000000";
165         mes "^FF0000HP ^000000Part Healing = "+(($QW_HP_H_PRICE)?"^00FF00"+$QW_HP_H_PRICE+"^000000 a point":"^FF0000Free^000000");
166         mes "^FF0000SP ^000000Part Healing = "+(($QW_HP_S_PRICE)?"^00FF00"+$QW_HP_S_PRICE+"^000000 a point":"^FF0000Free^000000");
167
168         if ($QW_S_PRICE && $QW_S_PRICE != 60) mes "Storage = ^00FF00 "+$QW_S_PRICE+" ^000000";
169         if (!$QW_S_PRICE) mes "Storage = ^FF0000 Free ^000000";
170         if ($QW_S_PRICE == 60) mes "Storage = ^0000FF Kafra Mode ^000000";
171         mes "Guild Storage = "+(($QW_GS_PRICE)?"^00FF00"+$QW_GS_PRICE:"^FF0000Free")+"^000000";
172         
173         switch(select("Basic - Warps","Advanced - Warps","Overseas - Warps","Basic Dungeon warp fee","Advanced Dungeon warp fee","Overseas Dungeon warp fee","Full Healing","Part Healing","Storage","Guild Storage","Back","Exit")) {
174         case 1:
175                 next;
176                 mes "Basic - Warps are = "+(($QW_BW_PRICE)?"^00FF00"+$QW_BW_PRICE:"^FF0000Free")+"^000000";
177                 mes "Basic - Warps are starter towns and related dungeons.";
178                 input $QW_BW_PRICE;
179                 goto Setprice;
180         case 2:
181                 next;
182                 mes "Advanced - Warps are = "+(($QW_AW_PRICE)?"^00FF00"+$QW_AW_PRICE:"^FF0000Free")+"^000000";
183                 mes "Advanced - Warps are towns and dungeons on the same island but not close to any starter town.";
184                 input $QW_AW_PRICE;
185                 goto Setprice;
186         case 3:
187                 next;
188                 mes "Overseas - Warps are = "+(($QW_OW_PRICE)?"^00FF00"+$QW_OW_PRICE:"^FF0000Free")+"^000000";
189                 mes "Overseas - Warps are towns and dungeons overseas reachable by boat from Alberta.";
190                 input $QW_OW_PRICE;
191                 goto Setprice;
192         case 4:
193                 next;
194                 mes "Basic Dungeon level warp fee = "+(($QW_BW_FEE)?"^00FF00"+$QW_BW_FEE:"^FF0000NO")+"^000000 zeny per level";
195                 mes "Basic - Warps are starter town related dungeons.";
196                 mes "Dungeon warp fees are calculated by maps away from entrance of the dungeon times Dungeon warp fee.";
197                 mes "These costs are on top of the regular Warp costs.";
198                 input $QW_BW_FEE;
199                 goto Setprice;
200         case 5:
201                 next;
202                 mes "Advanced Dungeon level warp fee = "+(($QW_AW_FEE)?"^00FF00"+$QW_AW_FEE:"^FF0000NO")+"^000000 zeny per level";
203                 mes "Advanced - Warps are dungeons not close to any starter town.";
204                 mes "Dungeon warp fees are calculated by maps away from entrance of the dungeon times Dungeon warp fee.";
205                 mes "These costs are on top of the regular Warp costs.";
206                 input $QW_AW_FEE;
207                 goto Setprice;
208         case 6:
209                 next;
210                 mes "Overseas Dungeon level warp fee = "+(($QW_OW_FEE)?"^00FF00"+$QW_OW_FEE:"^FF0000NO")+"^000000 zeny per level";
211                 mes "Overseas - Warps are dungeons related to towns overseas reachable by boat from Alberta.";
212                 mes "Dungeon warp fees are calculated by maps away from entrance of the dungeon times Dungeon warp fee.";
213                 mes "These costs are on top of the regular Warp costs.";
214                 input $QW_OW_FEE;
215                 goto Setprice;
216         case 7:
217                 next;
218                 mes "Full Healing = "+(($QW_HF_PRICE)?"^00FF00"+$QW_HF_PRICE:"^FF0000Free")+"^000000";
219                 mes "Instant full healing 1 price.";
220                 input $QW_HF_PRICE;
221                 goto Setprice;
222         case 8:
223                 next;
224                 mes "^FF0000HP ^000000Part Healing = "+(($QW_HP_H_PRICE)?"^00FF00"+$QW_HP_H_PRICE+"^000000 a point":"^FF0000Free^000000");
225                 mes "^FF0000SP ^000000Part Healing = "+(($QW_HP_S_PRICE)?"^00FF00"+$QW_HP_S_PRICE+"^000000 a point":"^FF0000Free^000000");
226                 mes "Healing price per 1 HP.";
227                 mes "Healing price per 1 SP.";
228                 mes "2 inputs, first HP then SP.";
229                 input $QW_HP_H_PRICE;
230                 input $QW_HP_S_PRICE;
231                 goto Setprice;
232         case 9:
233                 next;
234                 if ($QW_S_PRICE && $QW_S_PRICE != 60) mes "Storage = ^00FF00 "+$QW_S_PRICE+" ^000000";
235                 if (!$QW_S_PRICE) mes "Storage = ^FF0000 Free ^000000";
236                 if ($QW_S_PRICE == 60) mes "Storage = ^0000FF Kafra Mode ^000000";
237                 mes "Storage cost, if set to 60 Kafra pricing will be handled.";
238                 input $QW_S_PRICE;
239                 goto Setprice;
240         case 10:
241                 next;
242                 mes "Guild Storage = "+(($QW_GS_PRICE)?"^00FF00"+$QW_GS_PRICE:"^FF0000Free")+"^000000";
243                 mes "Guild Storage, free on Guild Kafras.";
244                 input $QW_GS_PRICE;
245                 goto Setprice;
246         case 11:
247                 goto GM_Menu;
248         default:
249                 close;
250                 end;
251         }
252
253 //======================Special=Warp=Menu==========================
254
255 SpecialWarpMenu:
256         if ($QW_SP_Warpname$ == "") set $QW_SP_Warpname$,"Special Warp";
257         next;
258         mes "Scroll down to see all the information";
259         mes "The Special warp menu option will show in the main menu when all towns & dungeons are unlocked";
260         mes "And when the map for special warping has been set";
261         mes "menu option name set to ^0000FF"+$QW_SP_Warpname$+"^000000";
262         if ($QW_SP_WarpMap$ == "") mes "map is currently ^FF0000not^000000 set, and Special warp menu is off";
263         if ($QW_SP_WarpMap$ != "") mes "map is currently set to ^0000FF"+$QW_SP_WarpMap$+"^000000 and Special Warp menu is on";
264         mes "coords are set to ^0000FF"+$QW_SP_WarpX+","+$QW_SP_WarpY+"^000000";
265         switch(select("Set Special Warp name to show in menu", "Set WarpMap","Set Coords","Go Back to GM_Menu","Exit")){
266         case 1:
267                 next;
268                 mes "Set the name to show in the menu as option.";
269                 input $QW_SP_Warpname$;
270                 goto SpecialWarpMenu;
271         case 2:
272                 next;
273                 mes "Set the map in the ^0000FFmapname^000000 format.";
274                 mes "When this warpmap is set the option for players will show once they meet the requirments.";
275                 mes "To disable Special Warp Menu option, clear this!";
276                 input $QW_SP_WarpMap$;
277                 goto SpecialWarpMenu;
278         case 3:
279                 next;
280                 mes "First input = Xcoord";
281                 mes "Second input = Ycoord";
282                 input $QW_SP_WarpX;
283                 input $QW_SP_WarpY;
284                 goto SpecialWarpMenu;
285         case 4:
286                 goto GM_Menu;
287         default:
288                 close;
289                 end;
290         }
291
292 //======================Dungeon=Level=Limit========================
293
294 DungeonLevelLimit:
295         next;
296         mes "Dungeon Depth limit is "+(($QW_DL)?"^00FF00On":"^FF0000Off")+"^000000";
297         mes "If^00FF00 On ^000000Dungeon Depth limit is set to ^0000FF"+$QW_DDL+"^000000";
298
299         switch(select("Toggle Dungeon Depth Limit","Set Dungeon Depth Limit","Go Back to GM_Menu","Exit")){
300         case 1: set $QW_DL,($QW_DL)?0:1; goto DungeonLevelLimit;
301         case 2:
302                 next;
303                 mes "Set limit of Dungeon Depth 0 = entrance";
304                 mes "Depth 1 is a map connected to 0 and so on";
305                 mes "Shortest Route to map counts as depth";
306                 input $QW_DDL;
307                 goto DungeonLevelLimit;
308         case 3: goto GM_Menu;
309         default:
310                 close;
311                 end;
312         }
313
314 //===========================Towns=================================
315
316 L_town:
317         callfunc "QWS_Tarray";
318         freeloop(1);
319         set .@menu$,"";
320         for(set .@i,0; .@i<35; set .@i,.@i+1)   // Expected maximum is 35
321                 set .@menu$,.@menu$+@Tmenulist$[.@i]+":";
322         freeloop(0);
323         set @TWMenu,select(.@menu$);
324
325         if (@Tmenuref[@TWMenu-1] == 57005) goto L_end; // 57005='dead' in hex
326
327         if(Zeny<@pTprice[@Tmenuref[@TWMenu-1]]) callsub L_Short_on_zeny,0;
328         set Zeny, Zeny-@pTprice[@Tmenuref[@TWMenu-1]];
329         if ($QW_KPoint == 1) set RESRVPTS, RESRVPTS + (@pTprice[@Tmenuref[@TWMenu-1]]/16);
330         warp @pTmap$[@Tmenuref[@TWMenu-1]],@pTXcoords[@Tmenuref[@TWMenu-1]],@pTYcoords[@Tmenuref[@TWMenu-1]];
331         close2;
332         set Zeny, Zeny+@pTprice[@Tmenuref[@TWMenu-1]];
333         end;
334
335 //=========================Dungeons================================
336
337 L_dungeon:
338         callfunc "QWS_Darray";
339         freeloop(1);
340         set .@menu$,"";
341         for(set .@i,0; .@i<35; set .@i,.@i+1)   // Expected maximum is 35
342                 set .@menu$,.@menu$+@Dmenulist$[.@i]+":";
343         freeloop(0);
344         set @DWMenu,select(.@menu$);
345
346         if (@Dmenuref[@DWMenu-1] == 57005) goto L_end; // 57005='dead' in hex
347         set @DwarpMenu, (@Dmenuref[@DWMenu-1]);
348         callfunc "QWS_DLarray";
349
350         next;
351         mes "[Warpra]";
352         mes "Please select where you want to go:";
353         freeloop(1);
354         set .@menu$,"";
355         for(set .@i,0; .@i<18; set .@i,.@i+1)   // Expected maximum is 18
356                 set .@menu$,.@menu$+@DWLmenulist$[.@i]+":";
357         freeloop(0);
358         set @DWLMenu,select(.@menu$);
359
360         if (@DWLmenuref[@DWLMenu-1] == 57005) goto L_end; // 57005='dead' in hex
361
362         set @Darrayref, @DWLmenuref[@DWLMenu-1];
363         set @warpprice, @pDprice[@Dmenuref[@DWMenu-1]]+(getd(@pDfee$[@Dmenuref[@DWMenu-1]])*(@DDepth[@Darrayref]));
364
365         if(Zeny<@warpprice) callsub L_Short_on_zeny,1;
366         set Zeny, Zeny-(@warpprice);
367         if ($QW_KPoint == 1) set RESRVPTS, RESRVPTS + (@warpprice/16);
368         warp @DGat$[@Darrayref],@DXcoords[@Darrayref],@DYcoords[@Darrayref];
369         close2;
370         set Zeny, Zeny+@pTprice[@Tmenuref[@DWMenu-1]];
371         end;
372
373 //=============================Healing=============================
374
375 L_heal_Full:
376         set @healfee, $QW_HF_PRICE;
377         if(Zeny<@healfee) callsub L_Short_on_zeny,4;
378         set Zeny, Zeny-@healfee;
379         if ($QW_KPoint == 1) set RESRVPTS, RESRVPTS + (@healfee/500);
380         next;
381         mes "[Warpra]";
382         mes "Close this window and I will heal you.";
383         close2;
384         percentheal 100,100;
385         end;
386
387 L_heal_Part:
388         set @healchoice,select("Full heal","Health Points only","Skill Points only","Exit");
389         if (@healchoice == 1) callsub PHeal,1,1;
390         if (@healchoice == 2) callsub PHeal,1,0;
391         if (@healchoice == 3) callsub PHeal,0,1;
392         goto L_end;
393         
394 PHeal:
395         next;
396         set @Hp, MaxHp-Hp;
397         set @Sp, MaxSp-Sp;
398         set @HpPrice, @hp*$QW_HP_H_PRICE;
399         set @SpPrice, @sp*$QW_HP_S_PRICE;
400         mes "[Warpra]";
401         if(getarg(0) == 1) mes ""+@HpPrice+" Zeny for "+@Hp+" health points";
402         if(getarg(1) == 1) mes ""+@SpPrice+" Zeny for "+@Sp+" skill points";
403         set @total, @HpPrice+@SpPrice;
404         mes "for a total of "+@total+" zeny";
405         if (select("Heal me","Let me see the choices again")==2) goto L_heal_Part;
406         
407         if(getarg(0) == 1)set @HpPrice, (MaxHp-Hp)*$QW_HP_H_PRICE;
408         if(getarg(1) == 1)set @SpPrice, (MaxSp-Sp)*$QW_HP_S_PRICE;
409         set @healfee, @HpPrice+@SpPrice;
410         if (getarg(0) == 1)&&(getarg(1) == 1)&&(Zeny<@healfee) goto Zeny_Short_Both;
411         if (getarg(0) == 1)&&(Zeny<@healfee) goto Zeny_short_HP;
412         if (getarg(1) == 1)&&(Zeny<@healfee) goto Zeny_short_SP;
413         set Zeny, Zeny-@healfee;
414         if (getarg(0) == 1)&&(getarg(1) == 1) percentheal 100,100;
415         if (getarg(0) == 1) percentheal 100,0;
416         if (getarg(1) == 1) percentheal 0,100;
417         close;
418         end;
419
420 Zeny_Short_Both:
421         mes "[Warpra]";
422         mes "Choose another option, you can afford both.";
423         mes "I can heal as much as you can afford, too.";
424         if (select("OK","Exit") == 2) goto L_end;
425         goto PHeal;
426
427 Zeny_short_HP:
428         mes "[Warpra]";
429         mes "Do you want me to partly heal your HP?";
430         if (select("Yes","No") == 2) goto L_end;
431         set @Hp, Zeny/$QW_HP_H_PRICE;
432         set @HpPrice, @Hp*$QW_HP_H_PRICE;
433         if (@Hp == 1) mes "You're not worth the effort.";
434         if (@Hp == 1) goto L_end;
435         set Zeny, Zeny-@HpPrice;
436         heal @Hp,0;
437         close;
438         end;
439
440 Zeny_short_SP:
441         mes "[Warpra]";
442         mes "Do you want me to partly heal your SP?";
443         if (select("Yes","No") == 2) goto L_end;
444         set @Sp, Zeny/$QW_HP_S_PRICE;
445         set @SpPrice, @Sp*$QW_HP_S_PRICE;
446         if (@Sp == 1) mes "You're not worth the effort.";
447         if (@Sp == 1) goto L_end;
448         set Zeny, Zeny-@SpPrice;
449         heal 0,@Sp;
450         close;
451         end;
452
453 //=============================Storage=============================
454
455 L_Storage:
456         next;
457         if(!callfunc("F_CanOpenStorage")) goto L_StorageJBlow;
458         set @fee, $QW_S_PRICE;
459         if ($QW_S_PRICE == 60)&&(BaseJob == Job_Novice) set @fee, 30;
460         if ($QW_S_PRICE == 60)&&(BaseJob != Job_Novice) set @fee, 60;
461         if(Zeny<@fee) callsub L_Short_on_zeny,2;
462         set Zeny, Zeny-@fee;
463         if ($QW_KPoint == 1) set RESRVPTS, RESRVPTS + (@fee/5);
464
465         mes "[Warpra]";
466         if(#kafra_code) {
467                 mes "Enter your storage password:";
468                 set @code_,0;
469                 input @code_;
470                 if(@code_ != #kafra_code) {
471                         dispbottom "Wrong storage password.";
472                         close;
473                 }
474                 set @kafcode_try,0;
475                 set @code_,0;
476         }
477         mes "Close this window and I will open your storage.";
478         close2;
479         openstorage;
480         end;
481
482 L_StorageJBlow:
483         mes "[Warpra]";
484         mes "I am sorry but you have to be at least Novice level 6 if you want to use the storage.";
485         return;
486
487 L_GStorage:
488         if (!@GID) {
489                 next;
490                 mes "[Warpra]";
491                 mes "You are not a part of a guild I can't help you.";
492                 close;
493                 end;
494         }
495         if (Zeny<$QW_GS_PRICE) callsub L_Short_on_zeny,3;
496         set Zeny, Zeny-$QW_GS_PRICE;
497         if ($QW_KPoint == 1) set RESRVPTS, RESRVPTS + ($QW_GS_PRICE/5);
498         next;
499         mes "[Warpra]";
500         mes "Close this window and I will open the ^5533FF" + GetGuildName(@GID) + "^000000 storage.";
501         close2;
502         guildopenstorage;
503         end;
504         
505 L_end:
506         close;
507         end;
508
509 //============================Few=Warp=============================
510 L_FewWarps:
511         next;
512         mes "[Warpra]";
513         mes "You need to unlock locations before they come available to you.";
514         mes "To unlock a location talk to my colleagues all over the world.";
515         mes "Each account has its own stamp card.";
516         mes "Want me to check what stamps you have collected so far?";
517         if (select("Yes","No")==1) callsub stampcard;
518         close;
519         end;
520
521 //============================No=Unlock============================
522 L_NoUnlock:
523         next;
524         mes "[Warpra]";
525         mes "I don't unlock this location, my assistant deeper in the dungeon will unlock this place.";
526         close;
527         end;
528         
529 //=========================Short=On=Zeny===========================
530 L_Short_on_zeny:
531         next;
532         switch(getarg(0)) {
533         case 0: mes "You don't seem to have "+@pTprice[@Tmenuref[@TWMenu-1]]+" zeny to pay for the warp to "+@pTmenuitems$[@Tmenuref[@TWMenu-1]]+"."; break;
534         case 1: mes "You don't seem to have "+@warpprice+" zeny to pay for the warp to "+@DLevelName$[@DWLmenuref[@DWLMenu-1]]+" at "+@pDmenuitems$[@Dmenuref[@DWMenu-1]]+"."; break;
535         case 2: mes "You don't seem to have "+@fee+" zeny to pay the storage fee."; break;
536         case 3: mes "You don't seem to have "+$QW_GS_PRICE+" zeny to pay the guild storage fee."; break;
537         case 4: mes "You don't seem to have "+@healfee+" zeny to pay for your healing."; break;
538         }
539         close;
540         end;
541         
542 //===========================Stamp=Card============================
543 stampcard:
544 // Counting of the ammount of places you have unlocked
545         next;
546         mes "Let me check what Towns you have.";
547         callfunc "QWS_TownStamps";
548         mes "You collected^00FF00 "+@Tstamp+" of "+@MaxTstamp+" ^000000Towns.";
549         if (@Tstamp == 15) {
550                 mes "They say there is an island you can only get to when married...";
551                 emotion e_heh;
552         }
553         next;
554         mes "Let me check what dungeons you have.";
555         callfunc "QWS_DungeonStamps";
556         mes "You collected^00FF00 "+@Dstamp+" of "+@MaxDstamp+" ^000000Dungeons.";
557         mes "To unlock a dungeon, search for my colleagues.";
558         mes "You can usually find them near the middle or end of the dungeon.";
559         return;
560 }
561
562 function        script  QWS_TownStamps  {
563         set @Tstamp,0;
564         set @MaxTstamp,30; //maximum number of towns
565         set @binvalue,1;
566         set @Tstamploop,0;
567         do {
568                 if ((@binvalue & ##QWS_T_Unlock) == @binvalue) set @Tstamp,@Tstamp+1;
569                 set @binvalue, @binvalue *2;
570                 set @Tstamploop, @Tstamploop + 1;
571         } while (@Tstamploop < @MaxTstamp);
572         return;
573 }
574
575 function        script  QWS_DungeonStamps       {
576         set @Dstamp,0;
577         set @MaxDstamp,29; //maximum number of dungeons
578         set @binvalue,1;
579         set @Dstamploop,0;
580         do {
581                 if ((@binvalue & ##QWS_D_Unlock) == @binvalue) set @Dstamp,@Dstamp+1;
582                 set @binvalue, @binvalue *2;
583                 set @Dstamploop, @Dstamploop + 1;
584         } while (@Dstamploop < @MaxDstamp);
585         return;
586 }
587
588 //======================Main=Menu=Array============================
589
590 function        script  QWS_MMarray     {
591
592         // Currently 9 items
593         setarray @pMmenuitems$[0], "GameMaster Menu", $QW_SP_Warpname$, "Warp to Towns", "Warp to Dungeons", "Why so few warps?", "Why don't you unlock this location?", "Heal", "Heal", "Storage", "Guild Storage", "Cancel";
594         set @Mi,0; // loop counter
595         set @Mj,0; // menu line counter
596
597 //----------------GameMaster-Menu
598         if (getgmlevel()>= 80) {
599                 set @Mmenulist$[@Mj],@pMmenuitems$[@Mi];
600                 set @Mmenuref[@Mj],@Mi;
601                 set @Mj,@Mj+1;
602         }
603         set @Mi,@Mi+1;
604 //----------------Special-Warp
605         callfunc "QWS_TownStamps";
606         callfunc "QWS_DungeonStamps";
607         if (@Tstamp == @MaxTstamp)&&(@Dstamp == @MaxDstamp)&&($QW_SP_WarpMap$ != "") {
608                 set @Mmenulist$[@Mj],@pMmenuitems$[@Mi];
609                 set @Mmenuref[@Mj],@Mi;
610                 set @Mj,@Mj+1;
611         }
612         set @Mi,@Mi+1;
613 //----------------Town-Warp
614         if ($QW_TW_OFF == 0) {
615                 set @Mmenulist$[@Mj],@pMmenuitems$[@Mi];
616                 set @Mmenuref[@Mj],@Mi;
617                 set @Mj,@Mj+1;
618         }
619         set @Mi,@Mi+1;
620 //----------------Dungeon-Warp
621         if ($QW_DW_OFF == 0) {
622                 set @Mmenulist$[@Mj],@pMmenuitems$[@Mi];
623                 set @Mmenuref[@Mj],@Mi;
624                 set @Mj,@Mj+1;
625         }
626         set @Mi,@Mi+1;
627 //----------------Why-So-Few-Warps
628         set @Mmenulist$[@Mj],@pMmenuitems$[@Mi];
629         set @Mmenuref[@Mj],@Mi;
630         set @Mj,@Mj+1;
631         set @Mi,@Mi+1;
632 //----------------No-Unlock
633         if (getarg(0) == 1) {
634                 set @Mmenulist$[@Mj],@pMmenuitems$[@Mi];
635                 set @Mmenuref[@Mj],@Mi;
636                 set @Mj,@Mj+1;
637         }
638         set @Mi,@Mi+1;
639 //----------------Healfull
640         if ($QW_HF == 1) {
641                 set @Mmenulist$[@Mj],@pMmenuitems$[@Mi];
642                 set @Mmenuref[@Mj],@Mi;
643                 set @Mj,@Mj+1;
644         }
645         set @Mi,@Mi+1;
646 //----------------Healpart
647         if ($QW_HP == 1) {
648                 set @Mmenulist$[@Mj],@pMmenuitems$[@Mi];
649                 set @Mmenuref[@Mj],@Mi;
650                 set @Mj,@Mj+1;
651         }
652         set @Mi,@Mi+1;
653 //----------------Storage
654         if ($QW_Stor == 1) {
655                 set @Mmenulist$[@Mj],@pMmenuitems$[@Mi];
656                 set @Mmenuref[@Mj],@Mi;
657                 set @Mj,@Mj+1;
658         }
659         set @Mi,@Mi+1;
660 //----------------GuildStorage
661         if ($QW_GStor == 1) {
662                 set @Mmenulist$[@Mj],@pMmenuitems$[@Mi];
663                 set @Mmenuref[@Mj],@Mi;
664                 set @Mj,@Mj+1;
665         }
666         set @Mi,@Mi+1;
667 //----------------Cancel
668         set @Mmenulist$[@Mj],@pMmenuitems$[@Mi];
669         set @Mmenuref[@Mj],@Mi;
670         return;
671 }
672
673 //======================Town=Menu=Array============================
674 // Adding a town:
675 //      setarray @pTmenuitems$[@Ti], "Prontera";// Name of Town shown in Town select Menu
676 //      setarray @pTprice[@Ti], $QW_BW_PRICE;   // Warp prices: Basic ($QW_BW_PRICE), Advanced ($QW_AW_PRICE), Overseas ($QW_OW_PRICE)
677 //
678 //      setarray @pTmap$[@Ti], "prontera";      // Map name
679 //      setarray @pTXcoords[@Ti], 156;          // X warp coords
680 //      setarray @pTYcoords[@Ti], 187;          // Y warp coords
681 //
682 //      QWS_Make_Town_Menu 0;   // Use a free number (last used is 30, Eclage)
683 //
684 // Adding a warpra:
685 //      map,x,y,facing  script  Warpra#example  113,{
686 //              callfunc "QWS_Town_Warpra",<town number>,"Your Town";
687 //              close;
688 //      }
689 //      Town number is the same as "QWS_Make_Town_Menu".
690 //==================================================================
691
692 function        script  QWS_Tarray      {
693         function QWS_Make_Town_Menu;
694
695         set @Ti,0; // loop counter
696         set @Tj,0; // menu lines counter
697
698 //----------------Prontera
699         setarray @pTmenuitems$[@Ti], "Prontera";
700         setarray @pTprice[@Ti], $QW_BW_PRICE;
701
702         setarray @pTmap$[@Ti], "prontera";
703         setarray @pTXcoords[@Ti], 156;
704         setarray @pTYcoords[@Ti], 187;
705
706         QWS_Make_Town_Menu 0;
707 //----------------Alberta
708         setarray @pTmenuitems$[@Ti], "Alberta";
709         setarray @pTprice[@Ti], $QW_BW_PRICE;
710
711         setarray @pTmap$[@Ti], "alberta";
712         setarray @pTXcoords[@Ti], 27;
713         setarray @pTYcoords[@Ti], 236;
714
715         QWS_Make_Town_Menu 1;
716 //----------------Aldebaran
717         setarray @pTmenuitems$[@Ti], "Aldebaran";
718         setarray @pTprice[@Ti], $QW_AW_PRICE;
719
720         setarray @pTmap$[@Ti], "aldebaran";
721         setarray @pTXcoords[@Ti], 145;
722         setarray @pTYcoords[@Ti], 120;
723
724         QWS_Make_Town_Menu 2;
725 //----------------Amatsu:
726         setarray @pTmenuitems$[@Ti], "Amatsu";
727         setarray @pTprice[@Ti], $QW_OW_PRICE;
728
729         setarray @pTmap$[@Ti], "amatsu";
730         setarray @pTXcoords[@Ti], 197;
731         setarray @pTYcoords[@Ti], 86;
732
733         QWS_Make_Town_Menu 3;
734 //----------------Ayothaya:
735         setarray @pTmenuitems$[@Ti], "Ayothaya";
736         setarray @pTprice[@Ti], $QW_OW_PRICE;
737
738         setarray @pTmap$[@Ti], "ayothaya";
739         setarray @pTXcoords[@Ti], 150;
740         setarray @pTYcoords[@Ti], 57;
741
742         QWS_Make_Town_Menu 4;
743 //----------------Brasilis:
744         setarray @pTmenuitems$[@Ti], "Brasilis";
745         setarray @pTprice[@Ti], $QW_OW_PRICE;
746
747         setarray @pTmap$[@Ti], "brasilis";
748         setarray @pTXcoords[@Ti], 195;
749         setarray @pTYcoords[@Ti], 220;
750
751         QWS_Make_Town_Menu 21;
752 //----------------Comodo:
753         setarray @pTmenuitems$[@Ti], "Comodo";
754         setarray @pTprice[@Ti], $QW_AW_PRICE;
755
756         setarray @pTmap$[@Ti], "comodo";
757         setarray @pTXcoords[@Ti], 188;
758         setarray @pTYcoords[@Ti], 161;
759
760         QWS_Make_Town_Menu 5;
761 //----------------Dewata:
762         setarray @pTmenuitems$[@Ti], "Dewata";
763         setarray @pTprice[@Ti], $QW_OW_PRICE;
764
765         setarray @pTmap$[@Ti], "dewata";
766         setarray @pTXcoords[@Ti], 199;
767         setarray @pTYcoords[@Ti], 179;
768
769         QWS_Make_Town_Menu 29;
770 //----------------Eclage:
771         setarray @pTmenuitems$[@Ti], "Eclage";
772         setarray @pTprice[@Ti], $QW_OW_PRICE;
773
774         setarray @pTmap$[@Ti], "eclage";
775         setarray @pTXcoords[@Ti], 111;
776         setarray @pTYcoords[@Ti], 39;
777
778         QWS_Make_Town_Menu 30;
779 //----------------Einbech:
780         setarray @pTmenuitems$[@Ti], "Einbech";
781         setarray @pTprice[@Ti], $QW_AW_PRICE;
782
783         setarray @pTmap$[@Ti], "einbech";
784         setarray @pTXcoords[@Ti], 172;
785         setarray @pTYcoords[@Ti], 126;
786
787         QWS_Make_Town_Menu 6;
788 //----------------Einbroch:
789         setarray @pTmenuitems$[@Ti], "Einbroch";
790         setarray @pTprice[@Ti], $QW_AW_PRICE;
791
792         setarray @pTmap$[@Ti], "einbroch";
793         setarray @pTXcoords[@Ti], 230;
794         setarray @pTYcoords[@Ti], 191;
795
796         QWS_Make_Town_Menu 7;
797 //----------------El Dicastes:
798         setarray @pTmenuitems$[@Ti], "El Dicastes";
799         setarray @pTprice[@Ti], $QW_OW_PRICE;
800
801         setarray @pTmap$[@Ti], "dicastes01";
802         setarray @pTXcoords[@Ti], 197;
803         setarray @pTYcoords[@Ti], 187;
804
805         QWS_Make_Town_Menu 22;
806 //----------------Geffen:
807         setarray @pTmenuitems$[@Ti], "Geffen";
808         setarray @pTprice[@Ti], $QW_BW_PRICE;
809
810         setarray @pTmap$[@Ti], "geffen";
811         setarray @pTXcoords[@Ti], 119;
812         setarray @pTYcoords[@Ti], 66;
813
814         QWS_Make_Town_Menu 8;
815 //----------------Gonryun:
816         setarray @pTmenuitems$[@Ti], "Gonryun";
817         setarray @pTprice[@Ti], $QW_OW_PRICE;
818
819         setarray @pTmap$[@Ti], "gonryun";
820         setarray @pTXcoords[@Ti], 150;
821         setarray @pTYcoords[@Ti], 130;
822
823         QWS_Make_Town_Menu 9;
824 //----------------Hugel:
825         setarray @pTmenuitems$[@Ti], "Hugel";
826         setarray @pTprice[@Ti], $QW_AW_PRICE;
827
828         setarray @pTmap$[@Ti], "hugel";
829         setarray @pTXcoords[@Ti], 95;
830         setarray @pTYcoords[@Ti], 121;
831
832         QWS_Make_Town_Menu 10;
833 //----------------Izlude:
834         setarray @pTmenuitems$[@Ti], "Izlude";
835         setarray @pTprice[@Ti], $QW_BW_PRICE;
836
837         setarray @pTmap$[@Ti], "izlude";
838         setarray @pTXcoords[@Ti], 128;
839         setarray @pTYcoords[@Ti], 111;
840
841         QWS_Make_Town_Menu 11;
842 //----------------Jawaii:
843         setarray @pTmenuitems$[@Ti], "Jawaii";
844         setarray @pTprice[@Ti], $QW_AW_PRICE;
845
846         setarray @pTmap$[@Ti], "jawaii";
847         setarray @pTXcoords[@Ti], 243;
848         setarray @pTYcoords[@Ti], 115;
849
850         QWS_Make_Town_Menu 12;
851 //----------------Lighthalzen:
852         setarray @pTmenuitems$[@Ti], "Lighthalzen";
853         setarray @pTprice[@Ti], $QW_AW_PRICE;
854
855         setarray @pTmap$[@Ti], "lighthalzen";
856         setarray @pTXcoords[@Ti], 158;
857         setarray @pTYcoords[@Ti], 110;
858
859         QWS_Make_Town_Menu 13;
860 //----------------Louyang:
861         setarray @pTmenuitems$[@Ti], "Louyang";
862         setarray @pTprice[@Ti], $QW_OW_PRICE;
863
864         setarray @pTmap$[@Ti], "louyang";
865         setarray @pTXcoords[@Ti], 210;
866         setarray @pTYcoords[@Ti], 108;
867
868         QWS_Make_Town_Menu 14;
869 //----------------Lutie
870         setarray @pTmenuitems$[@Ti], "Lutie";
871         setarray @pTprice[@Ti], $QW_AW_PRICE;
872
873         setarray @pTmap$[@Ti], "xmas";
874         setarray @pTXcoords[@Ti], 148;
875         setarray @pTYcoords[@Ti], 131;
876
877         QWS_Make_Town_Menu 15;
878 //----------------Manuk
879         setarray @pTmenuitems$[@Ti], "Manuk";
880         setarray @pTprice[@Ti], $QW_OW_PRICE;
881
882         setarray @pTmap$[@Ti], "manuk";
883         setarray @pTXcoords[@Ti], 260;
884         setarray @pTYcoords[@Ti], 175;
885
886         QWS_Make_Town_Menu 23;
887 //----------------Mora
888         setarray @pTmenuitems$[@Ti], "Mora";
889         setarray @pTprice[@Ti], $QW_OW_PRICE;
890
891         setarray @pTmap$[@Ti], "mora";
892         setarray @pTXcoords[@Ti], 111;
893         setarray @pTYcoords[@Ti], 97;
894
895         QWS_Make_Town_Menu 24;
896 //----------------Morroc:
897         setarray @pTmenuitems$[@Ti], "Morroc";
898         setarray @pTprice[@Ti], $QW_BW_PRICE;
899
900         setarray @pTmap$[@Ti], "morocc";
901         setarray @pTXcoords[@Ti], 159;
902         setarray @pTYcoords[@Ti], 93;
903
904         QWS_Make_Town_Menu 16;
905 //----------------Moscovia
906         setarray @pTmenuitems$[@Ti], "Moscovia";
907         setarray @pTprice[@Ti], $QW_OW_PRICE;
908
909         setarray @pTmap$[@Ti], "moscovia";
910         setarray @pTXcoords[@Ti], 219;
911         setarray @pTYcoords[@Ti], 193;
912
913         QWS_Make_Town_Menu 25;
914 //----------------Niflheim:
915         setarray @pTmenuitems$[@Ti], "Niflheim";
916         setarray @pTprice[@Ti], $QW_AW_PRICE;
917
918         setarray @pTmap$[@Ti], "niflheim";
919         setarray @pTXcoords[@Ti], 195;
920         setarray @pTYcoords[@Ti], 186;
921
922         QWS_Make_Town_Menu 17;
923 //----------------Payon:
924         setarray @pTmenuitems$[@Ti], "Payon";
925         setarray @pTprice[@Ti], $QW_BW_PRICE;
926
927         setarray @pTmap$[@Ti], "payon";
928         setarray @pTXcoords[@Ti], 152;
929         setarray @pTYcoords[@Ti], 75;
930
931         QWS_Make_Town_Menu 18;
932 //----------------Rachel
933         setarray @pTmenuitems$[@Ti], "Rachel";
934         setarray @pTprice[@Ti], $QW_AW_PRICE;
935
936         setarray @pTmap$[@Ti], "rachel";
937         setarray @pTXcoords[@Ti], 130;
938         setarray @pTYcoords[@Ti], 111;
939
940         QWS_Make_Town_Menu 26;
941 //----------------Splendide
942         setarray @pTmenuitems$[@Ti], "Splendide";
943         setarray @pTprice[@Ti], $QW_OW_PRICE;
944
945         setarray @pTmap$[@Ti], "splendide";
946         setarray @pTXcoords[@Ti], 200;
947         setarray @pTYcoords[@Ti], 153;
948
949         QWS_Make_Town_Menu 27;
950 //----------------Umbala:
951         setarray @pTmenuitems$[@Ti], "Umbala";
952         setarray @pTprice[@Ti], $QW_AW_PRICE;
953
954         setarray @pTmap$[@Ti], "umbala";
955         setarray @pTXcoords[@Ti], 130;
956         setarray @pTYcoords[@Ti], 130;
957
958         QWS_Make_Town_Menu 19;
959 //----------------Veins
960         setarray @pTmenuitems$[@Ti], "Veins";
961         setarray @pTprice[@Ti], $QW_OW_PRICE;
962
963         setarray @pTmap$[@Ti], "veins";
964         setarray @pTXcoords[@Ti], 216;
965         setarray @pTYcoords[@Ti], 123;
966
967         QWS_Make_Town_Menu 28;
968 //----------------Yuno:
969         setarray @pTmenuitems$[@Ti], "Yuno";
970         setarray @pTprice[@Ti], $QW_AW_PRICE;
971
972         setarray @pTmap$[@Ti], "yuno";
973         setarray @pTXcoords[@Ti], 160;
974         setarray @pTYcoords[@Ti], 168;
975
976         QWS_Make_Town_Menu 20;
977 //----------------Cancel
978         setarray @pTmenuitems$[@Ti], "Cancel";
979         setarray @pTprice[@Ti], 0;
980
981         set @Tmenulist$[@Tj],@pTmenuitems$[@Ti];
982         set @Tmenuref[@Tj],57005; // 57005='dead' in hex
983         return;
984
985
986 //----------------Make Town Menu Function
987
988 function        QWS_Make_Town_Menu      {
989         set @temptownmenubin,1;
990         if (getarg(0) == 0) goto menu_item;
991         set @templooptownmenu,0;
992         do {
993                 set @temptownmenubin, @temptownmenubin * 2;
994                 set @templooptownmenu, @templooptownmenu + 1;
995                 }while (getarg(0) > @templooptownmenu);
996 // check marker and make menu item
997 menu_item:
998         if ((@temptownmenubin & ##QWS_T_Unlock) != @temptownmenubin) {
999                 set @Ti,@Ti+1;
1000                 return;
1001         }
1002         if (@pTprice[@Ti] != 0)&&($QW_MapUserShow == 0) set @Tmenulist$[@Tj], @pTmenuitems$[@Ti]+" -> "+@pTprice[@Ti];
1003         if (@pTprice[@Ti] == 0)&&($QW_MapUserShow == 0) set @Tmenulist$[@Tj], @pTmenuitems$[@Ti];
1004         if (@pTprice[@Ti] != 0)&&($QW_MapUserShow == 1) set @Tmenulist$[@Tj], @pTmenuitems$[@Ti]+" ["+getmapusers(@pTmap$[@Ti])+"]"+" -> "+@pTprice[@Ti];
1005         if (@pTprice[@Ti] == 0)&&($QW_MapUserShow == 1) set @Tmenulist$[@Tj], @pTmenuitems$[@Ti]+" ["+getmapusers(@pTmap$[@Ti])+"]";
1006         set @Tmenuref[@Tj],@Ti;
1007         set @Tj,@Tj+1;
1008         set @Ti,@Ti+1;
1009         return;
1010 }
1011 }
1012
1013 //====================Dungeon=Menu=Arrays==========================
1014 // Adding a dungeon:
1015 //      setarray @pDmenuitems$[@Di], "Abyss Lake";      // Name of Dungeon shown in Dungeon select Menu
1016 //      setarray @pDprice[@Di], $QW_AW_PRICE;           // Warp prices: Basic ($QW_BW_PRICE), Advanced ($QW_AW_PRICE), Overseas ($QW_OW_PRICE)
1017 //      setarray @pDfee$[@Di], "$QW_AW_FEE";            // Identifier for fee caluclation: Basic ("$QW_BW_FEE"), Advanced ("$QW_AW_FEE"), Overseas ("$QW_OW_FEE")
1018 //      setarray @DLevels[@Di], 3;                      // Number of levels in dungeon
1019 //
1020 //      setarray @DGat$[@Dref], "abyss_01", "abyss_02", "abyss_03";     // Map names of dungeon levels
1021 //      setarray @DLevelName$[@Dref], "Level 1", "Level 2", "Level 3";  // Name of dungeon levels shown in Menu
1022 //      setarray @DXcoords[@Dref], 265, 275, 116;                       // X warp coords
1023 //      setarray @DYcoords[@Dref], 273, 270, 27;                        // Y warp coords
1024 //      setarray @DDepth[@Dref], 0, 1, 2;                               // Relative depth to entrance, to calculate extra warp fee
1025 //
1026 //      QWS_Make_Dungeon_Menu 0;        // Use a free number (last used is 28, Kiel Dungeon)
1027 //
1028 // Adding a warpra:
1029 //      map,x,y,facing  script  Warpra Helper#example   112,{
1030 //              callfunc "QWS_Dungeon_Warpra",<dungeon number>,"Your Dungeon";
1031 //              close;
1032 //      }
1033 //      Dungeon number is the same as "QWS_Make_Dungeon_Menu".
1034 //==================================================================
1035
1036 function        script  QWS_Darray      {
1037         function QWS_Make_Dungeon_Menu;
1038
1039         set @Di,0;
1040         set @Dj,0;
1041         set @Dref,0;
1042
1043 //----------------ABYSS LAKE
1044         setarray @pDmenuitems$[@Di], "Abyss Lake";
1045         setarray @pDprice[@Di], $QW_AW_PRICE;
1046         setarray @pDfee$[@Di], "$QW_AW_FEE";
1047         setarray @DLevels[@Di], 3;
1048
1049         setarray @DGat$[@Dref], "abyss_01", "abyss_02", "abyss_03";
1050         setarray @DLevelName$[@Dref], "Level 1", "Level 2", "Level 3";
1051         setarray @DXcoords[@Dref], 265, 275, 116;
1052         setarray @DYcoords[@Dref], 273, 270, 27;
1053         setarray @DDepth[@Dref], 0, 1, 2;
1054
1055         QWS_Make_Dungeon_Menu 0;
1056
1057 //----------------AMATSU DUNGEON
1058         setarray @pDmenuitems$[@Di], "Amatsu Dungeon";
1059         setarray @pDprice[@Di], $QW_OW_PRICE;
1060         setarray @pDfee$[@Di], "$QW_OW_FEE";
1061         setarray @DLevels[@Di], 3;
1062
1063         setarray @DGat$[@Dref], "ama_dun01", "ama_dun02", "ama_dun03";
1064         setarray @DLevelName$[@Dref], "Level 1", "Level 2", "Level 3";
1065         setarray @DXcoords[@Dref], 227, 32, 119;
1066         setarray @DYcoords[@Dref], 10, 43, 15;
1067         setarray @DDepth[@Dref], 0, 1, 2;
1068
1069         QWS_Make_Dungeon_Menu 1;
1070
1071 //----------------ANT HELL
1072         setarray @pDmenuitems$[@Di], "Ant Hell Dungeon"; 
1073         setarray @pDprice[@Di], $QW_BW_PRICE;
1074         setarray @pDfee$[@Di], "$QW_BW_FEE";
1075         setarray @DLevels[2], 2;
1076
1077         setarray @DGat$[@Dref], "anthell01", "anthell02";
1078         setarray @DLevelName$[@Dref], "Level 1", "Level 2";
1079         setarray @DXcoords[@Dref], 32, 34;
1080         setarray @DYcoords[@Dref], 262, 263;
1081         setarray @DDepth[@Dref], 0, 1;
1082
1083         QWS_Make_Dungeon_Menu 2;
1084
1085 //----------------AYOTAYA
1086         setarray @pDmenuitems$[@Di], "Ayotaya Dungeon";
1087         setarray @pDprice[@Di], $QW_OW_PRICE;
1088         setarray @pDfee$[@Di], "$QW_OW_FEE";
1089         setarray @DLevels[3], 2;
1090
1091         setarray @DGat$[@Dref], "ayo_dun01", "ayo_dun02";
1092         setarray @DLevelName$[@Dref], "Level 1", "Level 2";
1093         setarray @DXcoords[@Dref], 275, 150;
1094         setarray @DYcoords[@Dref], 17, 13;
1095         setarray @DDepth[@Dref], 0, 1;
1096
1097         QWS_Make_Dungeon_Menu 3;
1098
1099 //----------------BYALAN
1100         setarray @pDmenuitems$[@Di], "Byalan Dungeon";
1101         setarray @pDprice[@Di], $QW_BW_PRICE;
1102         setarray @pDfee$[@Di], "$QW_BW_FEE";
1103         setarray @DLevels[4], 5;
1104
1105         setarray @DGat$[@Dref], "iz_dun00", "iz_dun01", "iz_dun02", "iz_dun03", "iz_dun04";
1106         setarray @DLevelName$[@Dref], "Level 1", "Level 2", "Level 3", "Level 4", "Level 5";
1107         setarray @DXcoords[@Dref], 168, 41, 236, 32, 26;
1108         setarray @DYcoords[@Dref], 168, 37, 204, 63, 27;
1109         setarray @DDepth[@Dref], 0, 1, 2, 3, 4;
1110
1111         QWS_Make_Dungeon_Menu 4;
1112
1113 //----------------CLOCK TOWER
1114         setarray @pDmenuitems$[@Di], "Clock Tower Dungeon";
1115         setarray @pDprice[@Di], $QW_AW_PRICE;
1116         setarray @pDfee$[@Di], "$QW_AW_FEE";
1117         setarray @DLevels[5], 8;
1118
1119         setarray @DGat$[@Dref], "c_tower1", "c_tower2", "c_tower3", "c_tower4", "alde_dun01", "alde_dun02", "alde_dun03", "alde_dun04";
1120         setarray @DLevelName$[@Dref], "Clock Tower Level 1", "Clock Tower Level 2", "Clock Tower Level 3", "Clock Tower Level 4", "Basement 1F", "Basement 2F", "Basement 3F", "Basement 4F";
1121         setarray @DXcoords[@Dref], 200, 268, 64, 32, 197, 262, 276, 122;
1122         setarray @DYcoords[@Dref], 163, 26, 148, 63, 25, 41, 53, 125;
1123         setarray @DDepth[@Dref], 0, 1, 2, 3, 1, 2, 3, 4;
1124
1125         QWS_Make_Dungeon_Menu 5;
1126
1127 //----------------COAL MINE
1128         setarray @pDmenuitems$[@Di], "Coal Mine Dungeon";
1129         setarray @pDprice[@Di], $QW_AW_PRICE;
1130         setarray @pDfee$[@Di], "$QW_AW_FEE";
1131         setarray @DLevels[6], 3;
1132
1133         setarray @DGat$[@Dref], "mjo_dun01", "mjo_dun02", "mjo_dun03";
1134         setarray @DLevelName$[@Dref], "Level 1", "Level 2", "Level 3";
1135         setarray @DXcoords[@Dref], 52, 381, 302;
1136         setarray @DYcoords[@Dref], 17, 343, 261;
1137         setarray @DDepth[@Dref], 0, 1, 2;
1138
1139         QWS_Make_Dungeon_Menu 6;
1140
1141 //----------------CULVERT
1142         setarray @pDmenuitems$[@Di], "Culvert Dungeon";
1143         setarray @pDprice[@Di], $QW_BW_PRICE;
1144         setarray @pDfee$[@Di], "$QW_BW_FEE";
1145         setarray @DLevels[7], 4;
1146
1147         setarray @DGat$[@Dref], "prt_sewb1", "prt_sewb2", "prt_sewb3", "prt_sewb4";
1148         setarray @DLevelName$[@Dref], "Level 1", "Level 2", "Level 3", "Level 4";
1149         setarray @DXcoords[@Dref], 132, 19, 180, 100;
1150         setarray @DYcoords[@Dref], 248, 19, 169, 92;
1151         setarray @DDepth[@Dref], 0, 1, 2, 3;
1152
1153         QWS_Make_Dungeon_Menu 7;
1154
1155 //----------------EINBECH DUNGEON
1156         setarray @pDmenuitems$[@Di], "Einbech Dungeon";
1157         setarray @pDprice[@Di], $QW_AW_PRICE;
1158         setarray @pDfee$[@Di], "$QW_AW_FEE";
1159         setarray @DLevels[8], 2;
1160
1161         setarray @DGat$[@Dref], "ein_dun01", "ein_dun02";
1162         setarray @DLevelName$[@Dref], "Level 1", "Level 2";
1163         setarray @DXcoords[@Dref], 22, 292;
1164         setarray @DYcoords[@Dref], 14, 290;
1165         setarray @DDepth[@Dref], 0, 1;
1166
1167         QWS_Make_Dungeon_Menu 8;
1168
1169 //----------------GEFENIA DUNGEON
1170         setarray @pDmenuitems$[@Di], "Gefenia Dungeon";
1171         setarray @pDprice[@Di], $QW_BW_PRICE;
1172         setarray @pDfee$[@Di], "$QW_BW_FEE";
1173         setarray @DLevels[9], 4;
1174
1175         setarray @DGat$[@Dref], "gefenia01", "gefenia02", "gefenia03", "gefenia04";
1176         setarray @DLevelName$[@Dref], "Level 1", "Level 2", "Level 3", "Level 4";
1177         setarray @DXcoords[@Dref], 59, 201, 264, 33;
1178         setarray @DYcoords[@Dref], 167, 35, 236, 270;
1179         setarray @DDepth[@Dref], 0, 1, 2, 3;
1180
1181         QWS_Make_Dungeon_Menu 9;
1182
1183 //----------------GEFFEN DUNGEON
1184         setarray @pDmenuitems$[@Di], "Geffen Dungeon";
1185         setarray @pDprice[@Di], $QW_BW_PRICE;
1186         setarray @pDfee$[@Di], "$QW_BW_FEE";
1187         setarray @DLevels[@Di], 4;
1188
1189         setarray @DGat$[@Dref], "gef_dun00", "gef_dun01", "gef_dun02", "gef_dun03";
1190         setarray @DLevelName$[@Dref], "Level 1", "Level 2", "Level 3", "Level 4";
1191         setarray @DXcoords[@Dref], 104, 115, 106, 203;
1192         setarray @DYcoords[@Dref], 100, 236, 132, 200;
1193         setarray @DDepth[@Dref], 0, 1, 2, 3;
1194
1195         QWS_Make_Dungeon_Menu 10;
1196
1197 //----------------GLAST HEIM
1198         setarray @pDmenuitems$[@Di], "Glast Heim Dungeon";
1199         setarray @pDprice[@Di], $QW_BW_PRICE;
1200         setarray @pDfee$[@Di], "$QW_BW_FEE";
1201         setarray @DLevels[@Di], 17;
1202
1203         setarray @DGat$[@Dref], "glast_01", "gl_church", "gl_chyard", "gl_in01", "gl_cas01", "gl_cas02", "gl_knt01", "gl_knt02", "gl_prison", "gl_prison1", "gl_step", "gl_sew01", "gl_sew02", "gl_sew03", "gl_sew04", "gl_dun01", "gl_dun02";
1204         setarray @DLevelName$[@Dref], "Glast Heim Entrance", "St. Abbey", "Churchyard", "Inside Glast Heim", "Castle 1", "Castle 2", "Chivalry 1", "Chivalry 2", "Prison 1", "Prison 2", "Steps", "Sewers 1", "Sewers 2", "Sewers 3", "Sewers 4", "Lowest Cave 1", "Lowest Cave 2";
1205         setarray @DXcoords[@Dref], 370, 156, 147, 121, 199, 104, 150, 157, 14, 150, 117, 258, 108, 171, 68, 133, 224;
1206         setarray @DYcoords[@Dref], 300, 8, 15, 59, 29, 25, 10, 287, 70, 14, 124, 255, 291, 273, 277, 271, 274;
1207         setarray @DDepth[@Dref], 0, 1, 2, 1, 1, 2, 1, 2, 2, 3, 1, 4, 2, 3, 4, 5, 6;
1208
1209         QWS_Make_Dungeon_Menu 11;
1210
1211 //----------------GONRYUN DUNGEON
1212         setarray @pDmenuitems$[@Di], "Gonryun Dungeon";
1213         setarray @pDprice[@Di], $QW_OW_PRICE;
1214         setarray @pDfee$[@Di], "$QW_OW_FEE";
1215         setarray @DLevels[@Di], 3;
1216
1217         setarray @DGat$[@Dref], "gon_dun01", "gon_dun02", "gon_dun03";
1218         setarray @DLevelName$[@Dref], "Level 1", "Level 2", "Level 3";
1219         setarray @DXcoords[@Dref], 143, 17, 68;
1220         setarray @DYcoords[@Dref], 59, 114, 9;
1221         setarray @DDepth[@Dref], 0, 1, 2;
1222
1223         QWS_Make_Dungeon_Menu 12;
1224
1225 //----------------HIDDEN DUNGEON
1226         setarray @pDmenuitems$[@Di], "Hidden Dungeon";
1227         setarray @pDprice[@Di], $QW_BW_PRICE;
1228         setarray @pDfee$[@Di], "$QW_BW_FEE";
1229         setarray @DLevels[@Di], 3;
1230
1231         setarray @DGat$[@Dref], "prt_maze01", "prt_maze02", "prt_maze03";
1232         setarray @DLevelName$[@Dref], "Level 1", "Level 2", "Level 3";
1233         setarray @DXcoords[@Dref], 176, 94, 23;
1234         setarray @DYcoords[@Dref], 6, 19, 8;
1235         setarray @DDepth[@Dref], 0, 1, 2;
1236
1237         QWS_Make_Dungeon_Menu 13;
1238
1239 //----------------JUPEROS CAVE
1240         setarray @pDmenuitems$[@Di], "Juperos Cave";
1241         setarray @pDprice[@Di], $QW_AW_PRICE;
1242         setarray @pDfee$[@Di], "$QW_AW_FEE";
1243         setarray @DLevels[@Di], 2;
1244
1245         setarray @DGat$[@Dref], "juperos_01", "juperos_02";
1246         setarray @DLevelName$[@Dref], "Level 1", "Level 2";
1247         setarray @DXcoords[@Dref], 53, 36;
1248         setarray @DYcoords[@Dref], 247, 60;
1249         setarray @DDepth[@Dref], 0, 1;
1250
1251         QWS_Make_Dungeon_Menu 14;
1252
1253 //----------------KIEL DUNGEON
1254         setarray @pDmenuitems$[@Di], "Kiel Dungeon";
1255         setarray @pDprice[@Di], $QW_AW_PRICE;
1256         setarray @pDfee$[@Di], "$QW_AW_FEE";
1257         setarray @DLevels[@Di], 2;
1258
1259         setarray @DGat$[@Dref], "kh_dun01", "kh_dun02";
1260         setarray @DLevelName$[@Dref], "1st Floor", "2nd Floor";
1261         setarray @DXcoords[@Dref], 63, 42;
1262         setarray @DYcoords[@Dref], 10, 197;
1263         setarray @DDepth[@Dref], 0, 1;
1264
1265         QWS_Make_Dungeon_Menu 28;
1266
1267 //----------------LIGHTHALZEN BIO LAB
1268         setarray @pDmenuitems$[@Di], "Lighthalzen Bio Lab";
1269         setarray @pDprice[@Di], $QW_AW_PRICE;
1270         setarray @pDfee$[@Di], "$QW_AW_FEE";
1271         setarray @DLevels[@Di], 3;
1272
1273         setarray @DGat$[@Dref], "lhz_dun01", "lhz_dun02", "lhz_dun03";
1274         setarray @DLevelName$[@Dref], "Level 1", "Level 2", "Level 3";
1275         setarray @DXcoords[@Dref], 150, 150, 140;
1276         setarray @DYcoords[@Dref], 287, 18, 137;
1277         setarray @DDepth[@Dref], 0, 1, 2;
1278
1279         QWS_Make_Dungeon_Menu 15;
1280
1281 //----------------LOUYANG DUNGEON
1282         setarray @pDmenuitems$[@Di], "Louyang Dungeon";
1283         setarray @pDprice[@Di], $QW_OW_PRICE;
1284         setarray @pDfee$[@Di], "$QW_OW_FEE";
1285         setarray @DLevels[@Di], 2;
1286
1287         setarray @DGat$[@Dref], "lou_dun02", "lou_dun03";
1288         setarray @DLevelName$[@Dref], "Royal Tomb Level 1", "Royal Tomb Level 2";
1289         setarray @DXcoords[@Dref], 282, 165;
1290         setarray @DYcoords[@Dref], 20, 38;
1291         setarray @DDepth[@Dref], 0, 1;
1292
1293         QWS_Make_Dungeon_Menu 16;
1294
1295 //----------------MAGMA DUNGEON
1296         setarray @pDmenuitems$[@Di], "Magma Dungeon";
1297         setarray @pDprice[@Di], $QW_AW_PRICE;
1298         setarray @pDfee$[@Di], "$QW_AW_FEE";
1299         setarray @DLevels[@Di], 2;
1300
1301         setarray @DGat$[@Dref], "mag_dun01", "mag_dun02";
1302         setarray @DLevelName$[@Dref], "Level 1", "Level 2";
1303         setarray @DXcoords[@Dref], 126, 47;
1304         setarray @DYcoords[@Dref], 69, 32;
1305         setarray @DDepth[@Dref], 0, 1;
1306
1307         QWS_Make_Dungeon_Menu 17;
1308
1309 //----------------ODIN TEMPLE
1310         setarray @pDmenuitems$[@Di], "Odin Temple";
1311         setarray @pDprice[@Di], $QW_AW_PRICE;
1312         setarray @pDfee$[@Di], "$QW_AW_FEE";
1313         setarray @DLevels[@Di], 1;
1314
1315         setarray @DGat$[@Dref], "odin_tem01";
1316         setarray @DLevelName$[@Dref], "Level 1";
1317         setarray @DXcoords[@Dref], 96;
1318         setarray @DYcoords[@Dref], 145;
1319         setarray @DDepth[@Dref], 0;
1320
1321         QWS_Make_Dungeon_Menu 18;
1322
1323 //----------------ORC DUNGEON
1324         setarray @pDmenuitems$[@Di], "Orc Dungeon";
1325         setarray @pDprice[@Di], $QW_BW_PRICE;
1326         setarray @pDfee$[@Di], "$QW_BW_FEE";
1327         setarray @DLevels[@Di], 2;
1328
1329         setarray @DGat$[@Dref], "orcsdun01", "orcsdun02";
1330         setarray @DLevelName$[@Dref], "Level 1", "Level 2";
1331         setarray @DXcoords[@Dref], 32, 21;
1332         setarray @DYcoords[@Dref], 169, 185;
1333         setarray @DDepth[@Dref], 0, 1;
1334
1335         QWS_Make_Dungeon_Menu 19;
1336
1337 //----------------PAYON DUNGEON
1338         setarray @pDmenuitems$[@Di], "Payon Dungeon";
1339         setarray @pDprice[@Di], $QW_BW_PRICE;
1340         setarray @pDfee$[@Di], "$QW_BW_FEE";
1341         setarray @DLevels[@Di], 5;
1342
1343         setarray @DGat$[@Dref], "pay_dun00", "pay_dun01", "pay_dun02", "pay_dun03", "pay_dun04";
1344         setarray @DLevelName$[@Dref], "Level 1", "Level 2", "Level 3", "Level 4", "Level 5";
1345         setarray @DXcoords[@Dref], 22, 19, 19, 155, 201;
1346         setarray @DYcoords[@Dref], 180, 33, 63, 159, 204;
1347         setarray @DDepth[@Dref], 0, 1, 2, 3, 4;
1348
1349         QWS_Make_Dungeon_Menu 20;
1350
1351 //----------------PYRAMIDS
1352         setarray @pDmenuitems$[@Di], "Pyramids Dungeon";
1353         setarray @pDprice[@Di], $QW_BW_PRICE;
1354         setarray @pDfee$[@Di], "$QW_BW_FEE";
1355         setarray @DLevels[@Di], 6;
1356
1357         setarray @DGat$[@Dref], "moc_pryd01", "moc_pryd02", "moc_pryd03", "moc_pryd04", "moc_pryd05", "moc_pryd06";
1358         setarray @DLevelName$[@Dref], "Level 1", "Level 2", "Level 3", "Level 4", "Basement 1", "Basement 2";
1359         setarray @DXcoords[@Dref], 192, 10, 100, 181, 94, 192;
1360         setarray @DYcoords[@Dref], 9, 192, 92, 11, 96, 8;
1361         setarray @DDepth[@Dref], 0, 1, 2, 3, 1, 2;
1362
1363         QWS_Make_Dungeon_Menu 21;
1364
1365 //----------------SPHINX
1366         setarray @pDmenuitems$[@Di], "Sphinx Dungeon";
1367         setarray @pDprice[@Di], $QW_BW_PRICE;
1368         setarray @pDfee$[@Di], "$QW_BW_FEE";
1369         setarray @DLevels[@Di], 5;
1370
1371         setarray @DGat$[@Dref], "in_sphinx1", "in_sphinx2", "in_sphinx3", "in_sphinx4", "in_sphinx5";
1372         setarray @DLevelName$[@Dref], "Level 1", "Level 2", "Level 3", "Level 4", "Level 5";
1373         setarray @DXcoords[@Dref], 192, 149, 210, 10, 100;
1374         setarray @DYcoords[@Dref], 9, 81, 54, 222, 99;
1375         setarray @DDepth[@Dref], 0, 1, 2, 3, 4;
1376
1377         QWS_Make_Dungeon_Menu 22;
1378
1379 //----------------SUNKEN SHIP
1380         setarray @pDmenuitems$[@Di], "Sunken Ship Dungeon";
1381         setarray @pDprice[@Di], $QW_BW_PRICE;
1382         setarray @pDfee$[@Di], "$QW_BW_FEE";
1383         setarray @DLevels[@Di], 2;
1384
1385         setarray @DGat$[@Dref], "treasure01", "treasure02";
1386         setarray @DLevelName$[@Dref], "Level 1", "Level 2";
1387         setarray @DXcoords[@Dref], 69, 102;
1388         setarray @DYcoords[@Dref], 24, 27;
1389         setarray @DDepth[@Dref], 0, 1;
1390
1391         QWS_Make_Dungeon_Menu 23;
1392
1393 //----------------THANATOS TOWER
1394         setarray @pDmenuitems$[@Di], "Thanatos Tower";
1395         setarray @pDprice[@Di], $QW_AW_PRICE;
1396         setarray @pDfee$[@Di], "$QW_AW_FEE";
1397         setarray @DLevels[@Di], 13;
1398
1399         setarray @DGat$[@Dref], "tha_t01", "tha_t02", "tha_t03", "tha_t04", "tha_t05", "tha_t06", "tha_t07", "tha_t08", "tha_t09", "tha_t10", "tha_t11", "tha_t12", "thana_boss";
1400         setarray @DLevelName$[@Dref], "Level 1", "Level 2", "Level 3", "Level 4", "Level 5", "Level 6", "Level 7", "Level 8", "Level 9", "Level 10", "Level 11", "Level 12", "Thanatos Boss";
1401         setarray @DXcoords[@Dref], 150, 150, 220, 59, 62, 206, 35, 105, 88, 168, 90, 129, 85;
1402         setarray @DYcoords[@Dref], 35, 136, 158, 143, 11, 8, 166, 44, 145, 138, 36, 83, 76;
1403         setarray @DDepth[@Dref], 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12;
1404
1405         QWS_Make_Dungeon_Menu 24;
1406
1407 //----------------TOY FACTORY
1408         setarray @pDmenuitems$[@Di], "Toy Factory Dungeon";
1409         setarray @pDprice[@Di], $QW_AW_PRICE;
1410         setarray @pDfee$[@Di], "$QW_AW_FEE";
1411         setarray @DLevels[@Di], 2;
1412
1413         setarray @DGat$[@Dref], "xmas_dun01", "xmas_dun02";
1414         setarray @DLevelName$[@Dref], "Factory Warehouse", "Classifying Room";
1415         setarray @DXcoords[@Dref], 205, 129;
1416         setarray @DYcoords[@Dref], 16, 133;
1417         setarray @DDepth[@Dref], 0, 1;
1418
1419         QWS_Make_Dungeon_Menu 25;
1420
1421 //----------------TURTLE ISTLAND
1422         setarray @pDmenuitems$[@Di], "Turtle Island Dungeon";
1423         setarray @pDprice[@Di], $QW_AW_PRICE;
1424         setarray @pDfee$[@Di], "$QW_AW_FEE";
1425         setarray @DLevels[@Di], 4;
1426
1427         setarray @DGat$[@Dref], "tur_dun01", "tur_dun02", "tur_dun03", "tur_dun04";
1428         setarray @DLevelName$[@Dref], "Outside", "Level 1", "Level 2", "Level 3";
1429         setarray @DXcoords[@Dref], 161, 148, 132, 100;
1430         setarray @DYcoords[@Dref], 34, 256, 190, 192;
1431         setarray @DDepth[@Dref], 0, 0, 1, 2;
1432
1433         QWS_Make_Dungeon_Menu 26;
1434
1435 //----------------UMBALA
1436         setarray @pDmenuitems$[@Di], "Umbala Dungeon";
1437         setarray @pDprice[@Di], $QW_OW_PRICE;
1438         setarray @pDfee$[@Di], "$QW_OW_FEE";
1439         setarray @DLevels[@Di], 3;
1440
1441         setarray @DGat$[@Dref], "um_dun01", "um_dun02", "yggdrasil01";
1442         setarray @DLevelName$[@Dref], "Carpenter's Shop in The Tree", "Passage to a Foreign World", "Hvergelmir's Fountain";
1443         setarray @DXcoords[@Dref], 205, 48, 40;
1444         setarray @DYcoords[@Dref], 26, 30, 63;
1445         setarray @DDepth[@Dref], 0, 1, 2;
1446
1447         QWS_Make_Dungeon_Menu 27;
1448
1449 //----------------Cancel
1450         setarray @pDmenuitems$[@Di], "Cancel";
1451         setarray @pDprice[@Di], 0;
1452
1453         set @Dmenulist$[@Dj],@pDmenuitems$[@Di];
1454         set @Dmenuref[@Dj],57005; // 57005='dead' in hex
1455         return;
1456
1457
1458 //----------------Make Dungeon Menu Function
1459
1460 function        QWS_Make_Dungeon_Menu   {
1461         set @tempdungeonmenubin,1;
1462         if (getarg(0) == 0) goto menu_item;
1463         set @temploopdungeonmenu,0;
1464         do {
1465                 set @tempdungeonmenubin, @tempdungeonmenubin * 2;
1466                 set @temploopdungeonmenu, @temploopdungeonmenu + 1;
1467                 }while (getarg(0) > @temploopdungeonmenu);
1468 // check marker and make menu item
1469 menu_item:
1470         if ((@tempdungeonmenubin & ##QWS_D_Unlock) != @tempdungeonmenubin) {
1471                 setarray @DLocRef[@Di], @Dref;
1472                 set @Dref, @Dref+@DLevels[@Di];
1473                 set @Di,@Di+1;
1474                 return;
1475         }
1476         if ($QW_MapUserShow == 1) {
1477                 set @tempmapusers,0;
1478                 set @mapusersloop,0;
1479                 do {
1480                         set @tempmapusers,(getmapusers(@DGat$[@Dref+@mapusersloop]) + @tempmapusers);
1481                         set @mapusersloop, (@mapusersloop + 1);
1482                 } while (@DLevels[@Di] > @mapusersloop);
1483                 if (@pDprice[@Di] != 0) set @Dmenulist$[@Dj], @pDmenuitems$[@Di]+" ["+@tempmapusers+"] -> "+@pDprice[@Di];
1484                 if (@pDprice[@Di] == 0) set @Dmenulist$[@Dj], @pDmenuitems$[@Di]+" ["+@tempmapusers+"]";
1485                 set @Dmenuref[@Dj],@Di;
1486                 set @Dj,@Dj+1;
1487                 setarray @DLocRef[@Di], @Dref;
1488                 set @Dref, @Dref+@DLevels[@Di];
1489                 set @Di,@Di+1;
1490                 return;
1491         }
1492         if (@pDprice[@Di] != 0) set @Dmenulist$[@Dj], @pDmenuitems$[@Di]+" -> "+@pDprice[@Di];
1493         if (@pDprice[@Di] == 0) set @Dmenulist$[@Dj], @pDmenuitems$[@Di];
1494         set @Dmenuref[@Dj],@Di;
1495         set @Dj,@Dj+1;
1496         setarray @DLocRef[@Di], @Dref;
1497         set @Dref, @Dref+@DLevels[@Di];
1498         set @Di,@Di+1;
1499         return;
1500 }
1501 }
1502
1503 function        script  QWS_DLarray     {
1504 //----------------Start building Menu
1505         set @DWref,@DLocRef[@DwarpMenu]; // reference to the arrays with leveldata
1506         set @DWi,0;  // loop counter
1507         set @DWj,0; // menu lines counter
1508         cleararray @DWLmenulist$[0],"",20; // Clearing the array to get rid off ghost items in menu
1509         do {
1510                 if ($QW_DL == 0)||($QW_DDL >= @DDepth[@DWref]) {
1511                         set @warpprice, (@pDprice[@DwarpMenu]+ (getd(@pDfee$[@DwarpMenu])*@DDepth[@DWref]));
1512                         if (@warpprice != 0)&&($QW_MapUserShow == 0) set @DWLmenulist$[@DWj], @DLevelName$[@DWref]+" -> "+@warpprice;
1513                         if (@warpprice == 0)&&($QW_MapUserShow == 0) set @DWLmenulist$[@DWj], @DLevelName$[@DWref];
1514                         if (@warpprice != 0)&&($QW_MapUserShow == 1) set @DWLmenulist$[@DWj], @DLevelName$[@DWref]+" ["+getmapusers(@DGat$[@DWref])+"] -> "+@warpprice;
1515                         if (@warpprice == 0)&&($QW_MapUserShow == 1) set @DWLmenulist$[@DWj], @DLevelName$[@DWref]+" ["+getmapusers(@DGat$[@DWref])+"]";
1516                         set @DWLmenuref[@DWj],@DWref;
1517                         set @DWj,@DWj+1;
1518                 }
1519                 set @DWref, @DWref+1;
1520                 set @DWi,@DWi+1;
1521         } while (@DWi < @DLevels[@DwarpMenu]);
1522         set @DWLmenulist$[@DWj], "Exit";
1523         set @DWLmenuref[@DWj],57005; // 57005='dead' in hex
1524         return;
1525 }
1526
1527 //================Dungeon=Warpras=That=Only=Unlock=================
1528
1529 function        script  QWS_Dungeon_Warpra      {
1530         function QWS_D_getbin;
1531         function QWS_D_setbin;
1532         
1533         if ((QWS_D_getbin(getarg(0)) == 0) && (getarg(1) != "")) {
1534                 mes "[Warpra]";
1535                 mes getarg(1)+" unlocked!";
1536                 QWS_D_setbin(getarg(0));
1537                 return;
1538         } else if (QWS_D_getbin(getarg(0)) == 1) {
1539                 mes "[Warpra]";
1540                 mes "Sorry, I can only unlock this location.";
1541         } else
1542                 debugmes "QWS_Dungeon_Warpra error, improper syntax?";
1543         return;
1544
1545
1546 function        QWS_D_setbin    {
1547         set @tempsetbindata,1;
1548         if (getarg(0) == 0) goto binset;
1549         set @temploopsetbin,0;
1550         do {
1551                 set @tempsetbindata, @tempsetbindata * 2;
1552                 set @temploopsetbin, @temploopsetbin + 1;
1553         } while (getarg(0) > @temploopsetbin);
1554 binset:
1555         set ##QWS_D_Unlock,(##QWS_D_Unlock | @tempsetbindata);
1556         return;
1557 }
1558
1559 function        QWS_D_getbin    {
1560         set @tempgetbindata,1;
1561         if (getarg(0) == 0) goto binget;
1562         set @temploopgetbin,0;
1563         do {
1564                 set @tempgetbindata, @tempgetbindata * 2;
1565                 set @temploopgetbin, @temploopgetbin + 1;
1566         } while (getarg(0) > @temploopgetbin);
1567 binget:
1568         if ((@tempgetbindata & ##QWS_D_Unlock) == @tempgetbindata) return 1;
1569         return 0;
1570 }
1571 }
1572
1573 //==========================Town=Warpras===========================
1574
1575 function        script  QWS_Town_Warpra {
1576         function QWS_T_getbin;
1577         function QWS_T_setbin;
1578         
1579         if ((QWS_T_getbin(getarg(0)) == 0) && (getarg(1) != "")) {
1580                 mes "[Warpra]";
1581                 mes getarg(1)+" unlocked!";
1582                 QWS_T_setbin(getarg(0));
1583                 return;
1584         } else if (QWS_T_getbin(getarg(0)) == 1) {
1585                 callfunc "Q_Warpra",0;
1586         } else
1587                 debugmes "QWS_Town_Warpra error, improper syntax ?";
1588         return;
1589
1590 function        QWS_T_setbin    {
1591         set @tempsetbindata,1;
1592         if (getarg(0) == 0) goto binset;
1593         set @temploopsetbin,0;
1594         do {
1595                 set @tempsetbindata, @tempsetbindata * 2;
1596                 set @temploopsetbin, @temploopsetbin + 1;
1597         } while (getarg(0) > @temploopsetbin);
1598 binset:
1599         set ##QWS_T_Unlock,(##QWS_T_Unlock | @tempsetbindata);
1600         return;
1601 }
1602
1603 function        QWS_T_getbin    {
1604         set @tempgetbindata,1;
1605         if (getarg(0) == 0) goto binget;
1606         set @temploopgetbin,0;
1607         do {
1608                 set @tempgetbindata, @tempgetbindata * 2;
1609                 set @temploopgetbin, @temploopgetbin + 1;
1610         } while (getarg(0) > @temploopgetbin);
1611 binget:
1612         if ((@tempgetbindata & ##QWS_T_Unlock) == @tempgetbindata) return 1;
1613         return 0;
1614 }
1615 }
1616 //============================Warpras==============================
1617
1618 -       script  Warpra#0        -1,{ callfunc "Q_Warpra",1; }
1619 alb2trea,73,101,4       duplicate(Warpra#0)     Warpra#1        113
1620 ama_fild01,178,325,1    duplicate(Warpra#0)     Warpra#2        113
1621 gef_fild10,71,339,4     duplicate(Warpra#0)     Warpra#3        113
1622 izlu2dun,104,82,4       duplicate(Warpra#0)     Warpra#4        113
1623 mjolnir_02,85,363,4     duplicate(Warpra#0)     Warpra#5        113
1624 moc_fild04,207,331,4    duplicate(Warpra#0)     Warpra#6        113
1625 moc_fild19,106,97,4     duplicate(Warpra#0)     Warpra#7        113
1626 moc_ruins,64,166,4      duplicate(Warpra#0)     Warpra#8        113
1627 niflheim,197,192,3      duplicate(Warpra#0)     Warpra#9        113
1628 pay_arche,39,135,4      duplicate(Warpra#0)     Warpra#10       113
1629 prt_fild05,273,215,4    duplicate(Warpra#0)     Warpra#11       113
1630 tur_dun01,148,239,4     duplicate(Warpra#0)     Warpra#12       113
1631 valkyrie,48,35,8        duplicate(Warpra#0)     Warpra#13       113
1632 yuno_fild03,37,135,4    duplicate(Warpra#0)     Warpra#14       113
1633
1634 alberta,32,240,4        script  Warpra#15       113,{ callfunc "QWS_Town_Warpra",1,"Alberta Town"; close; }
1635 aldebaran,146,118,4     script  Warpra#16       113,{ callfunc "QWS_Town_Warpra",2,"Aldebaran Town"; close; }
1636 ayothaya,216,171,5      script  Warpra#17       113,{ callfunc "QWS_Town_Warpra",4,"Ayotaya Town"; close; }
1637 amatsu,193,81,1 script  Warpra#18       113,{ callfunc "QWS_Town_Warpra",3,"Amatsu Town"; close; }
1638 comodo,195,158,4        script  Warpra#19       113,{ callfunc "QWS_Town_Warpra",5,"Comodo Town"; close; }
1639 einbroch,229,196,5      script  Warpra#20       113,{ callfunc "QWS_Town_Warpra",7,"Einbroch Town"; close; }
1640 einbech,173,131,5       script  Warpra#21       113,{ callfunc "QWS_Town_Warpra",6,"Einbech Town"; close; }
1641 geffen,116,66,4 script  Warpra#22       113,{ callfunc "QWS_Town_Warpra",8,"Geffen Town"; close; }
1642 gonryun,152,130,4       script  Warpra#23       113,{ callfunc "QWS_Town_Warpra",9,"Gonryun Town"; close; }
1643 hugel,90,127,5  script  Warpra#24       113,{ callfunc "QWS_Town_Warpra",10,"Hugel Town"; close; }
1644 jawaii,107,182,5        script  Warpra#25       113,{ callfunc "QWS_Town_Warpra",12,"Jawaii Town"; close; }
1645 izlude,132,116,4        script  Warpra#26       113,{ callfunc "QWS_Town_Warpra",11,"Izlude Town"; close; }
1646 lighthalzen,153,100,5   script  Warpra#27       113,{ callfunc "QWS_Town_Warpra",13,"Lighthalzen Town"; close; }
1647 louyang,211,106,4       script  Warpra#28       113,{ callfunc "QWS_Town_Warpra",14,"Louyang Town"; close; }
1648 morocc,157,95,4 script  Warpra#29       113,{ callfunc "QWS_Town_Warpra",16,"Morroc Town"; close; }
1649 nif_fild01,319,77,1     script  Warpra#30       113,{ callfunc "QWS_Town_Warpra",17,"Niflheim Town"; close; }
1650 payon,183,110,4 script  Warpra#31       113,{ callfunc "QWS_Town_Warpra",18,"Payon Town"; close; }
1651 prontera,147,172,5      script  Warpra#32       113,{ callfunc "QWS_Town_Warpra",0,"Prontera Town"; close; }
1652 umbala,133,130,4        script  Warpra#33       113,{ callfunc "QWS_Town_Warpra",19,"Umbala Town"; close; }
1653 xmas,151,136,4  script  Warpra#34       113,{ callfunc "QWS_Town_Warpra",15,"Lutie Town"; close; }
1654 yuno,138,162,4  script  Warpra#35       113,{ callfunc "QWS_Town_Warpra",20,"Yuno Town"; close; }
1655 brasilis,201,222,4      script  Warpra#36       113,{ callfunc "QWS_Town_Warpra",21,"Brasilis Town"; close; }
1656 dicastes01,194,194,6    script  Warpra#37       113,{ callfunc "QWS_Town_Warpra",22,"El Dicastes Town"; close; }
1657 manuk,262,177,4 script  Warpra#38       113,{ callfunc "QWS_Town_Warpra",23,"Manuk Town"; close; }
1658 mora,110,100,4  script  Warpra#39       113,{ callfunc "QWS_Town_Warpra",24,"Mora Town"; close; }
1659 moscovia,216,196,6      script  Warpra#40       113,{ callfunc "QWS_Town_Warpra",25,"Moscovia Town"; close; }
1660 rachel,135,116,4        script  Warpra#41       113,{ callfunc "QWS_Town_Warpra",26,"Rachel Town"; close; }
1661 splendide,205,153,4     script  Warpra#42       113,{ callfunc "QWS_Town_Warpra",27,"Splendide Town"; close; }
1662 veins,214,123,4 script  Warpra#43       113,{ callfunc "QWS_Town_Warpra",28,"Veins Town"; close; }
1663 dewata,194,178,6        script  Warpra#44       113,{ callfunc "QWS_Town_Warpra",29,"Dewata Town"; close; }
1664 eclage,107,37,4 script  Warpra#45       113,{ callfunc "QWS_Town_Warpra",30,"Eclage Town"; close; }
1665
1666 abyss_02,274,266,1      script  Warpra Helper#0 112,{ callfunc "QWS_Dungeon_Warpra",0,"Abyss Lake"; close; }
1667 ama_dun02,192,118,5     script  Warpra Helper#1 112,{ callfunc "QWS_Dungeon_Warpra",1,"Amatsu Dungeon"; close; }
1668 anthell02,170,165,3     script  Warpra Helper#2 112,{ callfunc "QWS_Dungeon_Warpra",2,"Ant Hell Dungeon"; close; }
1669 ayo_dun02,258,193,5     script  Warpra Helper#3 112,{ callfunc "QWS_Dungeon_Warpra",3,"Ayotaya Dungeon"; close; }
1670 ein_dun02,292,282,1     script  Warpra Helper#4 112,{ callfunc "QWS_Dungeon_Warpra",8,"Einbech Dungeon"; close; }
1671 iz_dun03,202,47,2       script  Warpra Helper#5 112,{ callfunc "QWS_Dungeon_Warpra",4,"Byalan Dungeon"; close; }
1672 c_tower3,129,106,4      script  Warpra Helper#6 112,{ callfunc "QWS_Dungeon_Warpra",5,"Clock Tower Dungeon"; close; }
1673 mjo_dun02,39,25,4       script  Warpra Helper#7 112,{ callfunc "QWS_Dungeon_Warpra",6,"Coal Mine Dungeon"; close; }
1674 prt_sewb2,176,30,3      script  Warpra Helper#8 112,{ callfunc "QWS_Dungeon_Warpra",7,"Culvert Dungeon"; close; }
1675 gefenia03,137,34,0      script  Warpra Helper#9 112,{ callfunc "QWS_Dungeon_Warpra",9,"Gefenia Dungeon"; close; }
1676 gef_dun02,218,61,2      script  Warpra Helper#10        112,{ callfunc "QWS_Dungeon_Warpra",10,"Gefen Dungeon"; close; }
1677 glast_01,371,308,3      script  Warpra Helper#11        112,{ callfunc "QWS_Dungeon_Warpra",11,"Glast Heim Dungeon"; close; }
1678 gon_dun01,167,273,4     script  Warpra Helper#12        112,{ callfunc "QWS_Dungeon_Warpra",12,"Gonryun Dungeon"; close; }
1679 juperos_02,127,154,5    script  Warpra Helper#13        112,{ callfunc "QWS_Dungeon_Warpra",14,"Juperos Cave"; close; }
1680 kh_dun01,14,224,3       script  Warpra Helper#14        112,{ callfunc "QWS_Dungeon_Warpra",28,"Kiel Dungeon"; close; }
1681 lhz_dun02,156,151,5     script  Warpra Helper#15        112,{ callfunc "QWS_Dungeon_Warpra",15,"Lighthalzen Bio Lab"; close; }
1682 lou_dun02,168,264,4     script  Warpra Helper#16        112,{ callfunc "QWS_Dungeon_Warpra",16,"Louyang Dungeon"; close; }
1683 mag_dun02,46,41,3       script  Warpra Helper#17        112,{ callfunc "QWS_Dungeon_Warpra",17,"Magma Dungeon"; close; }
1684 odin_tem01,115,148,3    script  Warpra Helper#18        112,{ callfunc "QWS_Dungeon_Warpra",18,"Odin Temple"; close; }
1685 orcsdun01,185,11,3      script  Warpra Helper#19        112,{ callfunc "QWS_Dungeon_Warpra",19,"Orc Dungeon"; close; }
1686 pay_dun03,162,143,3     script  Warpra Helper#20        112,{ callfunc "QWS_Dungeon_Warpra",20,"Payon Dungeon"; close; }
1687 moc_pryd02,101,95,3     script  Warpra Helper#21        112,{ callfunc "QWS_Dungeon_Warpra",21,"Pyramides Dungeon"; close; }
1688 in_sphinx2,274,268,1    script  Warpra Helper#22        112,{ callfunc "QWS_Dungeon_Warpra",22,"Sphinx Dungeon"; close; }
1689 tha_t07,111,162,3       script  Warpra Helper#23        112,{ callfunc "QWS_Dungeon_Warpra",24,"Thanatos Tower"; close; }
1690 treasure02,104,40,3     script  Warpra Helper#24        112,{ callfunc "QWS_Dungeon_Warpra",23,"Sunken Ship Dungeon"; close; }
1691 xmas_dun02,124,131,3    script  Warpra Helper#25        112,{ callfunc "QWS_Dungeon_Warpra",25,"Toy Factory Dungeon"; close; }
1692 um_dun02,44,28,3        script  Warpra Helper#26        112,{ callfunc "QWS_Dungeon_Warpra",27,"Umbala Dungeon"; close; }
1693 tur_dun02,162,23,3      script  Warpra Helper#27        112,{ callfunc "QWS_Dungeon_Warpra",26,"Turtle Island Dungeon"; close; }
1694 prt_maze02,102,69,4     script  Warpra Helper#28        112,{ callfunc "QWS_Dungeon_Warpra",13,"Hidden Dungeon"; close; }