//===== rAthena Script =======================================
//= Infinite Space
//===== Description: =========================================
//= [Walkthrough Conversion]
//= Infinite Space with hard mode (Episode 16.1)
//===== Changelogs: ==========================================
//= 1.0 Initial release [crazyarashi]
//= 1.1 Updated to match official mechanics [Everade]
//= 1.2 Moved merchants to individual files [Everade]
//= 1.3 Cleanup and sanity checks [Everade]
//============================================================

cmd_fild07,58,278,3	script	Reckless Explorer#pa0829_01	4_F_GON,{
	mes "^FF0000Please note that, any abnormal monster handling inside the instance such as taming is not considered normal and may hinder the instance progress.^000000"; 
	next;
	if (BaseLevel < 100) {
		mes "[ Reckless Explorer ]";
		mes "Will you come back to me after getting a little bit stronger? How about getting to level 100 first?";
		close;
	}
	if (isbegin_quest(12364) != 2) {
		mes "[ Reckless Explorer ]";
		mes "Ah, no, I didn't meant to go inside. I didn't meant to violate any laws.";
		next;
		select("What are you talking about?");
		mes "[ Reckless Explorer ]";
		mes "Ha?";
		next;
		mes "[ Reckless Explorer ]";
		mes "Hmm, are you one of the Royal Palace's suppression squad?";
		next;
		select("I'm an ordinary adventurer.");
		mes "[ Reckless Explorer ]";
		mes "Phew~ That's a relief.";
		mes "I've never soon you before, so I thought you are one of the suppression squad of the palace.";
		next;
		if (select("What if I am one of the suppression squad?:What's the matter?") == 1) {
			mes "[ Reckless Explorer ]";
			mes "I'm just an ordinary woman who's out for a walk. And this is the end of my walk, and I'm going to...";
			close;
		}
		mes "[ Reckless Explorer ]";
		mes "Have you heard about the Paros Lighthouse collapse?";
		next;
		mes "[ Reckless Explorer ]";
		mes "^777700(She moved close to me)^000000";
		mes "The Paros Lighthouse here collapsed for some unknown reason some time ago, and there's a lot of stuff underneath it.";
		next;
		mes "[ Reckless Explorer ]";
		mes "Some of the restoration workers and guards that were sent to the palace went missing. Rumors has it that monsters are crawling down there.";
		next;
		mes "[ Reckless Explorer ]";
		mes "Because its depth is seemingly endless, the people here became afraid of this place and started calling it Infinite Space.";
		next;
		mes "[ Reckless Explorer ]";
		mes "I know some people who sneaked in and made a fortune. That's why I'm going to give it a try, are you interested?";
		next;
		if (select("I'm not interested.:Yes.") == 1) {
			mes "[ Reckless Explorer ]";
			mes "That's unfortunate. Come back whenever you change your mind. I'll welcome you anytime.";
			close;
		}
		mes "[ Reckless Explorer ]";
		mes "All right, Just one thing, I'm inexperienced and a novice adventurer. So I'll help you explore down there by guiding you from somewhere safe.";
		next;
		mes "[ Reckless Explorer ]";
		mes "I'm an adventure tour, and you can explore it yourself. Aren't we compatible with each other? Then, let's get started when you're ready.";
		setquest 12364;
		completequest 12364;
	} else {
		mes "[ Reckless Explorer ]";
		mes "Are you going in there again this time?";
		switch (checkquest(12365,PLAYTIME)) {
			case -1:
				break;

			case 0:
			case 1:
				next;
				mes "[ Reckless Explorer ]";
				mes "Oh, your whole body is shouting that it's tired. You can't go down there like this.";
				close;

			case 2:
				erasequest 12365;
				break;
		}
	}
	next;
	.@md_name$ = "Infinite Space";
	.@party_id = getcharid(1);
	if (!.@party_id) {
		mes "[ Reckless Explorer ]";
		mes "It's impossible alone. Would you like to organize a party at least one person or join another party and come back?";
		close;
	}
	if (select("Prepare to enter Infinite Space:Cancel") == 2)
		close;
	mes "[ Reckless Explorer ]";
	mes "Once the passage opens, take a breath for a while and talk to me again.";
	if (instance_create(.@md_name$) == -3)
		dispbottom "The reservation of the instance '" + .@md_name$ + "' has failed due to an active instance.";
	close;
}

cmd_fild07,54,280,5	script	Temporary Entrance#pa0829_01	PORTAL,{
	switch (checkquest(12365,PLAYTIME)) {
		case -1:
			break;

		case 0:
		case 1:
			mes "The passage is not yet activated.";
			close;

		case 2:
			erasequest 12365;
			break;
	}
	.@party_id = getcharid(1);
	.@party_name = getpartyname(.@party_id);
	.@md_name$ = "Infinite Space";
	switch (instance_enter(.@md_name$)) {
		case IE_OK:
			setquest 12365;
			mapannounce "cmd_fild07", strcharinfo(0) + " of the party, "+ .@party_name$ +", is entering the " + .@md_name$ + ".", bc_map, "0x00FF99";
			end;

		default:
			mes "The passage is not yet activated.";
			close;
	}
}

1@infi,1,1,0	script	#inf_space_control	HIDDEN_WARP_NPC,{
	end;

OnInstanceInit:
	'map$ = instance_mapname("1@infi");
	'floor = 1;
	'sanity = 0;

	enablenpc instance_npcname("#inf_space_mobs");
	enablenpc instance_npcname("#w0_0");
	enablenpc instance_npcname("#w0");
	disablenpc instance_npcname("#w50_ppl");
	hideonnpc instance_npcname("#w0");

	// Initiate Warp Portals
	for (.@i = 1; .@i < 50; .@i++)
		disablenpc instance_npcname("#w" + .@i);

	// Initiate Treasure Chests
	for (.@i = 10; .@i < 51; .@i += 10)
		disablenpc instance_npcname("#w" + .@i + "_t");

	// Initiate Floor Coordinates
	setarray .@xy[1],
	//1~10
	27,18,33,25,
	29,47,36,57,
	24,81,34,91,
	25,112,35,123,
	16,152,45,164,
	24,228,34,239,
	26,261,35,271,
	25,291,36,302,
	24,324,35,335,
	23,375,23,375,
	//11~20
	108,15,118,29,
	108,49,118,58,
	107,80,118,91,
	108,111,116,121,
	99,152,123,163,
	106,229,116,236,
	106,259,117,271,
	109,295,118,303,
	107,324,118,335,
	114,364,114,364,
	//21~30
	192,15,204,25,
	192,47,202,56,
	193,80,204,91,
	192,111,204,122,
	191,152,212,162,
	188,219,200,231,
	190,251,199,263,
	188,283,199,295,
	188,315,199,327,
	202,385,202,385,
	//31~40
	274,16,285,22,
	274,49,283,58,
	274,80,285,91,
	276,112,286,123,
	268,153,294,164,
	274,220,286,231,
	276,252,285,263,
	274,283,286,294,
	275,316,286,323,
	269,376,269,376,
	//40~50
	356,20,364,27,
	357,48,367,58,
	357,79,368,91,
	356,112,368,123,
	349,152,374,164,
	362,221,371,230,
	360,251,372,263,
	361,283,372,295,
	360,315,372,325,
	354,376,354,376;
	for (.@i = 1; .@i < getarraysize(.@xy); .@i += 4) {
		.@f++;
		setd("'xy_" + .@f + "$",.@xy[.@i] + "," + .@xy[.@i+1] + "," + .@xy[.@i+2] + "," + .@xy[.@i+3]);
	}
end;
}

// Monster spawn mechanics
1@infi,1,1,0	script	#inf_space_mobs	HIDDEN_WARP_NPC,{
	end;

OnSummonPoring:
	.@event2$ = instance_npcname(strnpcinfo(0)) + "::OnPoringKill";
	if (!mobcount('map$,.@event2$)) {
		explode(.@xy$,getd("'xy_" + 'floor + "$"),",");
		areamonster 'map$,atoi(.@xy$[0]),atoi(.@xy$[1]),atoi(.@xy$[2]),atoi(.@xy$[3]),"--ja--",3494,1,.@event2$;
		initnpctimer;
	}
	end;

OnTimer20000:
	.@event2$ = instance_npcname(strnpcinfo(0)) + "::OnPoringKill";
	killmonster 'map$,.@event2$;
	stopnpctimer;
	end;

OnSummon:
	.@event$ = instance_npcname(strnpcinfo(0)) + "::OnMobKill";
	switch ('floor) {
		case 1:
			setarray .@mob,3384,3385,3386;
			setarray .@amount,6,5,3;
			break;

		case 2:
			setarray .@mob,3384,3386,3387;
			setarray .@amount,6,3,2;
			break;

		case 3:
			setarray .@mob,3385,3386,3387;
			setarray .@amount,5,3,4;
			break;

		case 4:
			setarray .@mob,3386,3387,3388;
			setarray .@amount,3,5,3;
			break;

		case 5:
			setarray .@mob,3386,3387,3388,3389,3390,3391;
			setarray .@amount,5,3,5,2,2,1;
			break;

		case 6:
			setarray .@mob,3387,3388,3389;
			setarray .@amount,9,4,2;
			break;

		case 7:
			setarray .@mob,3388,3389,3390;
			setarray .@amount,8,7,2;
			break;

		case 8:
			setarray .@mob,3389,3390,3391;
			setarray .@amount,6,3,3;
			break;

		case 9:
			setarray .@mob,3390,3391,3392;
			setarray .@amount,7,4,6;
			break;

		case 10:
			setarray .@mob,3426;
			setarray .@amount,1;
			break;

		case 11:
			setarray .@mob,3391,3392,3393;
			setarray .@amount,5,5,4;
			break;

		case 12:
			setarray .@mob,3392,3393,3394;
			setarray .@amount,9,5,1;
			break;

		case 13:
			setarray .@mob,3393,3394,3395;
			setarray .@amount,8,3,5;
			break;

		case 14:
			setarray .@mob,3394,3395,3396;
			setarray .@amount,9,6,5;
			break;

		case 15:
			setarray .@mob,3393,3394,3395,3396,3397,3398,3399;
			setarray .@amount,4,4,7,5,3,4,3;
			break;

		case 16:
			setarray .@mob,3395,3396,3397;
			setarray .@amount,6,4,5;
			break;

		case 17:
			setarray .@mob,3396,3397,3398;
			setarray .@amount,7,4,4;
			break;

		case 18:
			setarray .@mob,3397,3398,3399;
			setarray .@amount,7,6,4;
			break;

		case 19:
			setarray .@mob,3398,3399,3400;
			setarray .@amount,9,4,3;
			break;

		case 20:
			setarray .@mob,3427;
			setarray .@amount,1;
			break;

		case 21:
			setarray .@mob,3399,3400,3401;
			setarray .@amount,7,5,3;
			break;

		case 22:
			setarray .@mob,3400,3401,3402;
			setarray .@amount,8,6,2;
			break;

		case 23:
			setarray .@mob,3401,3402,3403;
			setarray .@amount,8,7,5;
			break;

		case 24:
			setarray .@mob,3402,3403,3404;
			setarray .@amount,8,6,5;
			break;

		case 25:
			setarray .@mob,3402,3403,3404,3405,3406,3407,3408;
			setarray .@amount,3,4,5,4,3,3,2;
			break;

		case 26:
			setarray .@mob,3403,3404,3405;
			setarray .@amount,7,6,5;
			break;

		case 27:
			setarray .@mob,3404,3405,3406;
			setarray .@amount,6,5,5;
			break;

		case 28:
			setarray .@mob,3405,3406,3407;
			setarray .@amount,9,5,4;
			break;

		case 29:
			setarray .@mob,3406,3407,3408;
			setarray .@amount,7,5,2;
			break;

		case 30:
			setarray .@mob,3428;
			setarray .@amount,1;
			break;

		case 31:
			setarray .@mob,3407,3408,3409;
			setarray .@amount,8,4,4;
			break;

		case 32:
			setarray .@mob,3408,3409,3410;
			setarray .@amount,5,4,5;
			break;

		case 33:
			setarray .@mob,3409,3410,3411;
			setarray .@amount,6,5,3;
			break;

		case 34:
			setarray .@mob,3410,3411,3412;
			setarray .@amount,7,3,2;
			break;

		case 35:
			setarray .@mob,3409,3410,3411,3412,3413,3414;
			setarray .@amount,6,6,4,5,3,4;
			break;

		case 36:
			setarray .@mob,3411,3412,3413;
			setarray .@amount,8,3,3;
			break;

		case 37:
			setarray .@mob,3412,3413,3414;
			setarray .@amount,6,5,6;
			break;

		case 38:
			setarray .@mob,3413,3414,3415;
			setarray .@amount,6,4,2;
			break;

		case 39:
			setarray .@mob,3414,3415,3416;
			setarray .@amount,6,6,4;
			break;

		case 40:
			setarray .@mob,3429;
			setarray .@amount,1;
			break;

		case 41:
			setarray .@mob,3415,3416,3417;
			setarray .@amount,7,4,3;
			break;

		case 42:
			setarray .@mob,3416,3417,3418;
			setarray .@amount,8,3,5;
			break;

		case 43:
			setarray .@mob,3417,3418,3419;
			setarray .@amount,5,4,2;
			break;

		case 44:
			setarray .@mob,3418,3419,3420;
			setarray .@amount,5,7,2;
			break;

		case 45:
			setarray .@mob,3414,3415,3416,3417,3418,3419,3420;
			setarray .@amount,4,5,4,3,6,5,4;
			break;

		case 46:
			setarray .@mob,3412,3419;
			setarray .@amount,2,7;
			break;

		case 47:
			setarray .@mob,3413,3419,3420;
			setarray .@amount,4,7,6;
			break;

		case 48:
			setarray .@mob,3414,3419,3420;
			setarray .@amount,3,6,6;
			break;

		case 49:
			setarray .@mob,3415,3419,3420;
			setarray .@amount,4,5,9;
			break;

		case 50:
			setarray .@mob,3430;
			setarray .@amount,1;
			break;
	}

	if (rand(1,100) <= 'poring_chance)
		donpcevent instance_npcname(strnpcinfo(0)) + "::OnSummonPoring";

	explode(.@xy$,getd("'xy_" + 'floor + "$"),",");
	for (.@i = 0; .@i < getarraysize(.@mob); .@i++) {
		areamonster 'map$,atoi(.@xy$[0]),atoi(.@xy$[1]),atoi(.@xy$[2]),atoi(.@xy$[3]),"--ja--",.@mob[.@i],.@amount[.@i],.@event$;
		if (('floor % 10) == 0) {
			'boss_id = $@mobid[0];
			donpcevent instance_npcname(strnpcinfo(0)) + "::OnUnitSpawn";
		}
	}
	if ('floor > 0 && 'floor % 10 > 0 && 'mode == 2) {
		if (rand(1,100) <= 10) {
			.@boss_id = rand(3421,3425);
			while ('last_boss == .@boss_id)
				.@boss_id = rand(3421,3425);
			'last_boss = .@boss_id;
			areamonster 'map$,atoi(.@xy$[0]),atoi(.@xy$[1]),atoi(.@xy$[2]),atoi(.@xy$[3]),"--ja--",.@boss_id,1,.@event$;
		}
	}
	end;

OnUnitSpawn:
	.@event$ = instance_npcname(strnpcinfo(0)) + "::OnUnitKill";

	setarray .@mob_id,3426,3427,3428,3429,3430;
	setarray .@spawn,3436,3437,3438,3439,3440;
	setarray .@amount,5,7,7,6,6;

	setarray .@unit_id,3431,3432,3433,3434,3435,3436,3437,3438,3439,3440;
	setarray .@unit_amount,3,3,4,4,5,5,4,4,5,5;
	getunitdata 'boss_id,.@data;
	.@index = inarray(.@mob_id,.@data[UMOB_CLASS]);
	.@x = .@data[UMOB_X];
	.@y = .@data[UMOB_Y];
	areamonster 'map$,.@x,.@y,.@x,.@y,"--ja--",.@spawn[.@index],.@amount[.@index],.@event$;
	if ('mode == 2) {
		sleep 10000;
		while (.@index < getarraysize(.@unit_id)) {
			if (unitexists('boss_id)) {
				mapannounce 'map$,"The boss monster is trying to summon its allies.",0xFFFF00;
				getunitdata 'boss_id,.@data;
				.@x = .@data[UMOB_X];
				.@y = .@data[UMOB_Y];
				areamonster 'map$,.@x - 3,.@y - 3,.@x + 3,.@y + 3,"--ja--",.@unit_id[.@index],.@unit_amount[.@index],.@event$;
				.@index++;
			} else 
				break;
			sleep 5000;
		}
	}
OnUnitKill:
	end;

OnMobKill:
	.@event$ = instance_npcname(strnpcinfo(0)) + "::OnMobKill";
	if (rand(1,100) <= 'poring_chance)
		donpcevent instance_npcname(strnpcinfo(0)) + "::OnSummonPoring";
	if (!mobcount('map$,.@event$)) {
		sleep 5000;
		// Boss Stage, spawn Treasure Chest
		if (('floor%10) == 0)
			enablenpc instance_npcname("#w" + 'floor + "_t");

		if ('floor == 50) {
			mapannounce 'map$,"Reckless Explorer : It seems there are no other way from here. It's dangerous, so you'd better return outside.",0xFFFF00;
			enablenpc instance_npcname("#w50_ppl");
		}
		if ('floor < 50) {
			if (('floor%10) == 0)
				mapannounce 'map$,"Reckless Explorer : This area is safe. Use the passage to go to the next area.",0xFFFF00;
			else
				mapannounce 'map$,"Reckless Explorer : This area is safe. Go through the passage to the next area.",0xFFFF00;
			// Enable warp portal to next floor
			enablenpc instance_npcname("#w" + 'floor);
			'floor += 1;
		}
	}
OnPoringKill:
	end;
}

1@infi,42,8,1	script	#w0_0	4_F_GON,{
	if (is_party_leader() && !'mode && 'sanity == 0) {
		mes "[ Reckless Explorer ]";
		mes "I have went in and out of this place many times and figured out a way to provoke the monsters in here. You can get more rewards if you're going to deal with heated ones.";
		next;
		mes "[ Reckless Explorer ]";
		mes "What do you think? Would you like to try something challenging?";
		next;
		if (select("I want to proceed normally:I want to proceed with something difficult") == 1 && 'sanity == 0) {
			'mode = 1;
			'poring_chance = 1;
		} else {
			'mode = 2;
			'poring_chance = 2;
		}
		mes "[ Reckless Explorer ]";
		mes "Good. Shall we go now?";
		close2;
		if ('sanity == 0) {
			'sanity = 1;
			disablenpc instance_npcname(strnpcinfo(0));
			hideoffnpc instance_npcname("#w0");
			npctalk "Reckless Explorer : Woah~ It's very neat for a sunken place, don't you think?",instance_npcname("#w0");
			sleep 3000;
			npctalk "Reckless Explorer : I would believe it to be an ancient site, not a lighthouse. It's so well organized...",instance_npcname("#w0");
			sleep 3000;
			npctalk "Reckless Explorer : Oh, did you hear something?",instance_npcname("#w0");
			donpcevent instance_npcname("#inf_space_mobs") + "::OnSummon";
			sleep 3000;
			npctalk "Reckless Explorer : Oh, that must be the monsters haunting this place.",instance_npcname("#w0");
			sleep 3000;
			npctalk "Reckless Explorer : They look no different from the ones we saw outside, but I can feel a very strong energy.",instance_npcname("#w0");
			sleep 3000;
			npctalk "Reckless Explorer : Hm~ It looks dangerous, so I'll go back up. I'll give you directions from above.",instance_npcname("#w0");
			disablenpc instance_npcname("#w0");
		}
	}
	end;
}

1@infi,42,8,1	script	#w0	4_F_GON,{
	end;
}

1@infi,366,392,4	script	#w50_ppl	4_F_GON,{
	mes "[ Reckless Explorer ]";
	mes "I'll keep a separate record of this expedition. If you've been lucky, you might have gotten a decent reward from your expedition.";
	next;
	mes "[ Reckless Explorer ]";
	mes "So, shall we get out of here?";
	close2;
	warp "cmd_fild07",53,270;
	end;
}

1@infi,30,369,3	script	#w10_t	4_TREASURE_BOX,{
	if (is_party_leader()) {
		specialeffect EF_COIN;
		disablenpc instance_npcname(strnpcinfo(0));
		sleep 1000;
		if ('mode == 1)
			.@amount = rand(3,10);	// Min/Max found in replays
		else
			.@amount = rand(6,22);	// Min/Max found in replays
		getmapxy(.@map$,.@x,.@y,BL_NPC);
		for (.@i = 0; .@i < .@amount; .@i++) {
			switch (rand(1,4)) {
				case 1:
					.@xs = 1;
					.@ys = 1;
					break;

				case 2:
					.@xs = -1;
					.@ys = 1;
					break;

				case 3:
					.@xs = 1;
					.@ys = -1;
					break;

				case 4:
					.@xs = -1;
					.@ys = -1;
					break;
			}
			makeitem 6905,1,.@map$,.@x + .@xs,.@y + .@ys;
        }
		if ('mode == 2) {
			setarray .@equip_id,1994,1938,13323,13126,28703,2024,16038,21014,28105,18128;
			getmapxy(.@map$,.@x,.@y,BL_NPC);
			for (.@i = 0; .@i < getarraysize(.@equip_id); .@i++) {
				if (rand(1,100) <= 1) {
					switch (rand(1,4)) {
						case 1:
							.@xs = 1;
							.@ys = 1;
							break;

						case 2:
							.@xs = -1;
							.@ys = 1;
							break;

						case 3:
							.@xs = 1;
							.@ys = -1;
							break;

						case 4:
							.@xs = -1;
							.@ys = -1;
							break;
					}
					makeitem2 .@equip_id[.@i],1,.@map$,.@x + .@xs,.@y + .@ys,0,0,0,0,0,0,0;
				}
			}
		}
	}
	end;
}

1@infi,112,369,3	duplicate(#w10_t)	#w20_t	4_TREASURE_BOX
1@infi,194,380,3	duplicate(#w10_t)	#w30_t	4_TREASURE_BOX
1@infi,280,380,3	duplicate(#w10_t)	#w40_t	4_TREASURE_BOX
1@infi,366,380,3	duplicate(#w10_t)	#w50_t	4_TREASURE_BOX
// Aegis spawns hard mode specific treasure npcs
//1@infi,112,369,3	duplicate(#w10h_t)	#w20h_t	4_TREASURE_BOX
//1@infi,194,380,3	duplicate(#w10h_t)	#w30h_t	4_TREASURE_BOX
//1@infi,280,380,3	duplicate(#w10h_t)	#w40h_t	4_TREASURE_BOX
//1@infi,366,380,3	duplicate(#w10h_t)	#w50h_t	4_TREASURE_BOX

1@infi,30,31,0	script	#w1	WARPNPC,2,2,{
	end;

OnTouch:
	.@id = atoi(replacestr(strnpcinfo(2),"w",""));
	switch (.@id) {
		case 1: .@x = 30; .@y = 41; break;
		case 2: .@x = 30; .@y = 73; break;
		case 3: .@x = 30; .@y = 105; break;
		case 4: .@x = 30; .@y = 137; break;
		case 5: .@x = 30; .@y = 220; break;
		case 6: .@x = 30; .@y = 253; break;
		case 7: .@x = 30; .@y = 285; break;
		case 8: .@x = 30; .@y = 317; break;
		case 9: .@x = 30; .@y = 349; break;
		case 10: .@x = 112; .@y = 10; break;
		case 11: .@x = 112; .@y = 41; break;
		case 12: .@x = 112; .@y = 73; break;
		case 13: .@x = 112; .@y = 105; break;
		case 14: .@x = 112; .@y = 137; break;
		case 15: .@x = 112; .@y = 220; break;
		case 16: .@x = 112; .@y = 253; break;
		case 17: .@x = 112; .@y = 285; break;
		case 18: .@x = 112; .@y = 317; break;
		case 19: .@x = 112; .@y = 349; break;
		case 20: .@x = 198; .@y = 10; break;
		case 21: .@x = 198; .@y = 41; break;
		case 22: .@x = 198; .@y = 73; break;
		case 23: .@x = 198; .@y = 105; break;
		case 24: .@x = 198; .@y = 137; break;
		case 25: .@x = 198; .@y = 220; break;
		case 26: .@x = 198; .@y = 245; break;
		case 27: .@x = 198; .@y = 277; break;
		case 28: .@x = 198; .@y = 309; break;
		case 29: .@x = 198; .@y = 341; break;
		case 30: .@x = 280; .@y = 10; break;
		case 31: .@x = 280; .@y = 41; break;
		case 32: .@x = 280; .@y = 73; break;
		case 33: .@x = 280; .@y = 105; break;
		case 34: .@x = 280; .@y = 137; break;
		case 35: .@x = 280; .@y = 220; break;
		case 36: .@x = 280; .@y = 245; break;
		case 37: .@x = 280; .@y = 277; break;
		case 38: .@x = 280; .@y = 309; break;
		case 39: .@x = 280; .@y = 341; break;
		case 40: .@x = 362; .@y = 10; break;
		case 41: .@x = 362; .@y = 41; break;
		case 42: .@x = 362; .@y = 73; break;
		case 43: .@x = 362; .@y = 105; break;
		case 44: .@x = 362; .@y = 137; break;
		case 45: .@x = 362; .@y = 220; break;
		case 46: .@x = 362; .@y = 245; break;
		case 47: .@x = 362; .@y = 277; break;
		case 48: .@x = 362; .@y = 309; break;
		case 49: .@x = 362; .@y = 341; break;
		default: end;
	}
	warp 'map$,.@x,.@y;
	if (is_party_leader())
		sleep 100;
		if ('sanity < 'floor ) {
			donpcevent instance_npcname("#inf_space_mobs") + "::OnSummon";
			'sanity += 1;
		}
end;
}

1@infi,30,63,0	duplicate(#w1)	#w2	WARPNPC,2,2
1@infi,30,95,0	duplicate(#w1)	#w3	WARPNPC,2,2
1@infi,30,127,0	duplicate(#w1)	#w4	WARPNPC,2,2
1@infi,30,168,0	duplicate(#w1)	#w5	WARPNPC,2,2
1@infi,30,243,0	duplicate(#w1)	#w6	WARPNPC,2,2
1@infi,30,275,0	duplicate(#w1)	#w7	WARPNPC,2,2
1@infi,30,307,0	duplicate(#w1)	#w8	WARPNPC,2,2
1@infi,30,339,0	duplicate(#w1)	#w9	WARPNPC,2,2
1@infi,30,380,0	duplicate(#w1)	#w10	WARPNPC,2,2
1@infi,112,31,0	duplicate(#w1)	#w11	WARPNPC,2,2
1@infi,112,63,0	duplicate(#w1)	#w12	WARPNPC,2,2
1@infi,112,95,0	duplicate(#w1)	#w13	WARPNPC,2,2
1@infi,112,127,0	duplicate(#w1)	#w14	WARPNPC,2,2
1@infi,112,168,0	duplicate(#w1)	#w15	WARPNPC,2,2
1@infi,112,243,0	duplicate(#w1)	#w16	WARPNPC,2,2
1@infi,112,275,0	duplicate(#w1)	#w17	WARPNPC,2,2
1@infi,112,307,0	duplicate(#w1)	#w18	WARPNPC,2,2
1@infi,112,339,0	duplicate(#w1)	#w19	WARPNPC,2,2
1@infi,112,380,0	duplicate(#w1)	#w20	WARPNPC,2,2
1@infi,198,31,0	duplicate(#w1)	#w21	WARPNPC,2,2
1@infi,198,63,0	duplicate(#w1)	#w22	WARPNPC,2,2
1@infi,198,95,0	duplicate(#w1)	#w23	WARPNPC,2,2
1@infi,198,127,0	duplicate(#w1)	#w24	WARPNPC,2,2
1@infi,198,168,0	duplicate(#w1)	#w25	WARPNPC,2,2
1@infi,194,235,0	duplicate(#w1)	#w26	WARPNPC,2,2
1@infi,194,267,0	duplicate(#w1)	#w27	WARPNPC,2,2
1@infi,194,299,0	duplicate(#w1)	#w28	WARPNPC,2,2
1@infi,194,331,0	duplicate(#w1)	#w29	WARPNPC,2,2
1@infi,194,392,0	duplicate(#w1)	#w30	WARPNPC,2,2
1@infi,280,31,0	duplicate(#w1)	#w31	WARPNPC,2,2
1@infi,280,63,0	duplicate(#w1)	#w32	WARPNPC,2,2
1@infi,280,95,0	duplicate(#w1)	#w33	WARPNPC,2,2
1@infi,280,127,0	duplicate(#w1)	#w34	WARPNPC,2,2
1@infi,280,168,0	duplicate(#w1)	#w35	WARPNPC,2,2
1@infi,280,235,0	duplicate(#w1)	#w36	WARPNPC,2,2
1@infi,280,267,0	duplicate(#w1)	#w37	WARPNPC,2,2
1@infi,280,299,0	duplicate(#w1)	#w38	WARPNPC,2,2
1@infi,280,331,0	duplicate(#w1)	#w39	WARPNPC,2,2
1@infi,280,392,0	duplicate(#w1)	#w40	WARPNPC,2,2
1@infi,362,31,0	duplicate(#w1)	#w41	WARPNPC,2,2
1@infi,362,63,0	duplicate(#w1)	#w42	WARPNPC,2,2
1@infi,362,95,0	duplicate(#w1)	#w43	WARPNPC,2,2
1@infi,362,127,0	duplicate(#w1)	#w44	WARPNPC,2,2
1@infi,362,168,0	duplicate(#w1)	#w45	WARPNPC,2,2
1@infi,366,235,0	duplicate(#w1)	#w46	WARPNPC,2,2
1@infi,366,267,0	duplicate(#w1)	#w47	WARPNPC,2,2
1@infi,366,299,0	duplicate(#w1)	#w48	WARPNPC,2,2
1@infi,366,331,0	duplicate(#w1)	#w49	WARPNPC,2,2
