//===== rAthena Script =======================================
//= Poring Village
//===== Description: =========================================
//= [Walkthrough Conversion]
//= Poring Village instance
//===== Changelogs: ==========================================
//= 1.0 First version. [Capuche]
//============================================================

// Enchant
prt_fild05,174,238,7	script	Veggie Enchanter#0	4_F_02,2,2,{
	mes "[Veggie Enchanter]";
	mes "50 Jellopies and 20,000 zeny are all you need to get special effect on your green onion or carrot!";
	next;
	mes "[Veggie Enchanter]";
	mes "Enchant and reset have ^ff000030% of failure.^000000 Invest in your veggie and luck!";
	next;
	switch( select( "How much do I need to enchant?", "Enchant to Poring Village Veggie", "Reset Poring Village Veggie" ) ) {
	case 1:
		mes "[Veggie Enchanter]";
		mes "As I heard, you can get Poring Village Green Onion or Carrot if you go west a bit more from here.";
		next;
		mes "[Veggie Enchanter]";
		mes "I do enchant to the fresh vegetable.";
		next;
		mes "[Veggie Enchanter]";
		mes "Enchant or Reset requires 20,000z and 50 Jellopy! It's not bad, is it?";
		next;
		mes "[Veggie Enchanter]";
		mes "Well... As you know, it's a vegetable any way. So sometimes it can be broken.";
		close;
	case 2:
		.@equip_id = getequipid(EQI_HEAD_LOW);

		switch( .@equip_id ) {
		case -1:
			mes "[Veggie Enchanter]";
			mes "Please put on the equipment you'd like to enchant first.";
			close;
		case 19238:	// PoringTownOnion
		case 19239:	// PoringTownCarrot
			break;
		default:
			mes "[Veggie Enchanter]";
			mes "This is not a vegetable!?";
			close;
		}
		if (getequipcardid(EQI_HEAD_LOW,3) > 0) {
			mes "[Veggie Enchanter]";
			mes "This vegetable cannot be enchanted anymore.";
			close;
		}
		if (countitem(909) < 50 || Zeny < 20000) {
			mes "[Veggie Enchanter]";
			mes "This enchant requires 50 Jellopy and 20,000z..... But... you don't have them.";
			close;
		}
		delequip EQI_HEAD_LOW;
		delitem 909,50;	// Jellopy
		Zeny -= 20000;

		if (rand(100) < 70) {
			.@r = rand(5356);
			if (.@r < 160) .@card = 4795;	// HP100
			else if (.@r < 200) .@card = 4796;	// HP200
			else if (.@r < 1000) .@card = 4928;	// SP10
			else if (.@r < 1400) .@card = 4870;	// SP25
			else if (.@r < 1480) .@card = 4800;	// SP50
			else if (.@r < 1880) .@card = 4700;	// Strength1
			else if (.@r < 2280) .@card = 4730;	// Agility1
			else if (.@r < 3410) .@card = 4740;	// Vitality1
			else if (.@r < 3810) .@card = 4710;	// Inteligence1
			else if (.@r < 4210) .@card = 4720;	// Dexterity1
			else if (.@r < 5340) .@card = 4750;	// Luck1
			else if (.@r < 5348) .@card = 4992;	// HPdrain1
			else if (.@r < 5356) .@card = 4993;	// SPdrain1

			getitem2 .@equip_id,1,1,0,0,0,0,0,.@card;
			mes "[Veggie Enchanter]";
			mes "Tada! Enchant is done! Check your vegetable.";
			specialeffect2 EF_REPAIRWEAPON;
			close;
		}
		mes "[Veggie Enchanter]";
		mes "It must have been a rotten vegetable. It's a shame that I can't stand this level of power...";
		specialeffect2 EF_LORD;
		close;
	case 3:
		.@equip_id = getequipid(EQI_HEAD_LOW);

		switch( .@equip_id ) {
		case -1:
			mes "[Veggie Enchanter]";
			mes "Please put on the equipment you'd like to enchant first.";
			close;
		case 19238:	// PoringTownOnion
		case 19239:	// PoringTownCarrot
			break;
		default:
			mes "[Veggie Enchanter]";
			mes "This is not a vegetable!?";
			close;
		}
		if (getequipcardid(EQI_HEAD_LOW,3) == 0) {
			mes "[Veggie Enchanter]";
			mes "This is a vegetable that has never been fortified...";
			close;
		}
		if (countitem(909) < 50 || Zeny < 20000) {
			mes "[Veggie Enchanter]";
			mes "This enchant requires 50 Jellopy and 20,000z..... But... you don't have them.";
			close;
		}
		delequip EQI_HEAD_LOW;
		delitem 909,50;	// Jellopy
		Zeny -= 20000;

		if (rand(100) < 70) {
			getitem .@equip_id,1;
			mes "[Veggie Enchanter]";
			mes "The item is complete! Check it out.";
			specialeffect2 EF_REPAIRWEAPON;
			close;
		}
		mes "[Veggie Enchanter]";
		mes "It must have been a rotten vegetable. It's a shame that I can't stand this level of power...";
		specialeffect2 EF_LORD;
		close;
	}
	end;

OnTouch:
	npctalk "Veggie Enchanter: Make your green onion or carrot stronger!", "", bc_self;
	end;
}


// Instance
prt_fild05,145,235,5	script	Emily#0	4_GEFFEN_03,4,4,{
	if (BaseLevel < 30) {
		mes "[Emily]";
		mes "Wow~ You look like a novice. I do want to adventure with you someday when you grow up!";
		close;
	}
	if (BaseLevel > 60) {
		mes "[Emily]";
		mes "Oh, now you are stronger than me. How did you grow so fast?";
		next;
		mes "[Emily]";
		mes "I should find another adventurer who is similar with my level. It's been nice knowing you.";
		close;
	}
	if (isbegin_quest(12416) == 0) {
		mes "[Emily]";
		mes "My name is Emily. I was waiting for someone who will go on adventures with me!";
		next;
		select("Who said I will adventure with you?");
		mes "[Emily]";
		mes "Well, come one. Don't be stern. Listen, you can decide after listening to my story. Of course, I can give you a proper reward.";
		next;
		if (select( "Proper Reward?", "I'm not interested." ) == 2) {
			mes "[Emily]";
			mes "How square! It's much better to be together!";
			close;
		}
		mes "[Emily]";
		mes "Yes! Proper Reward.";
		next;
		mes "[Emily]";
		mes "It seems this Poring Village can be defeated by beginners just like us. It's just a wild guess though...";
		next;
		mes "[Emily]";
		mes "Well, actually I cannot give you the reward officially through adventurer association. But we can separate the income after hunting.";
		next;
		select("But 50-50 sounds fair to me.");
		mes "[Emily]";
		mes "No way. 70-30. And I'm 70 of course.";
		next;
		select("It's gotta be 50-50 or it's no good");
		mes "[Emily]";
		mes "How about 60-40!!";
		next;
		select("50-50 ...");
		mes "[Emily]";
		mes "This drives me crazy. OK, 50-50. Let's go with this.";
		setquest 12416;	// Contract with Emily
		completequest 12416;
		close;
	}
	switch( checkquest(12417,PLAYTIME) ) {
	case -1:
		break;
	case 0:
	case 1:
		mes "^ff0000Any processing of monsters such as monster taming inside the dungeon will not be considered a normal progress. Please note that.^000000";
		next;
		mes "^ff0000In beginner mode, the player transforms into a monster. Please note that the existing transformation effect disappears when entering and proceeding.^000000";
		next;
		mes "[Emily]";
		mes "So, are you ready?";
		next;
		mes "[Emily]";
		mes "You look very tired.";
		next;
		mes "[Emily]";
		mes "Why don't you come back after a while? Take a break for now.";
		close;
	case 2:
		mes "^ff0000Any processing of monsters such as monster taming inside the dungeon will not be considered a normal progress. Please note that.^000000";
		next;
		mes "^ff0000In beginner mode, the player transforms into a monster. Please note that the existing transformation effect disappears when entering and proceeding. ^000000";
		next;
		mes "[Emily]";
		mes "So, are you ready?";
		next;
		mes "^0000ffAll Traces of the Poring Village quest were removed. Now, talk to Emily again to enter^000000";
		erasequest 12417;
		close;
	}
	mes "^ff0000Any processing of monsters such as monster taming inside the dungeon will not be considered a normal progress. Please note that.^000000";
	next;
	mes "^ff0000In beginner mode, the player transforms into a monster. Please note that the existing transformation effect disappears when entering and proceeding.^000000";
	next;
	mes "[Emily]";
	mes "So, are you ready?";
	if (isbegin_quest(12418) == 0)
		setquest 12418;	// First Visit to Poring Village
	next;
	if (getcharid(1) < 1) {
		mes "[Emily]";
		mes "Hmm you should create a party first to start this grand adventure.";
		close;
	}
	.@md_name$ = "Poring Village";

	if (is_party_leader())
		.@menu$[0] = "Create the entrance";
	if (instance_live_info(ILI_NAME, instance_id(IM_PARTY)) == .@md_name$)
		.@menu$[1] = "Enter the dungeon";

	switch( select( .@menu$[0], .@menu$[1], "Cancel" ) ) {
	case 1:
		mes "[Emily]";
		mes "Now I'm looking for the entrance, please talk to me again after it's totally open.";
		instance_create(.@md_name$);
		close;
	case 2:
		switch( instance_enter(.@md_name$) ) {
		case IE_OTHER:
			mes "An unknown error occurred.";
			close;
		case IE_NOINSTANCE:
			mes "^ff0000Time's crack is not created yet.^000000";
			close;
		case IE_NOMEMBER:
			end;
		case IE_OK:
			mapannounce "prt_fild05", "Party member " + strcharinfo(0) + " of the party " + getpartyname(getcharid(0)) + " enters " + .@md_name$ + ".", bc_map,0xFF9900;
			setquest 12417;	// Overcoming fatigue
			// warp "1@begi",100,22;
			end;
		}
		end;
	case 3:
		end;
	}
	end;

OnTouch:
	if (isbegin_quest(12416) == 0 && BaseLevel >= 30 && BaseLevel <= 60)
		npctalk "Emily: Hey, there! May I talk to you for a minute?";
	end;

OnInit:
	questinfo( QTYPE_JUMPING_PORING, QMARK_YELLOW , "isbegin_quest(12416) == 0 && BaseLevel >= 30 && BaseLevel <= 60" );
	end;
}

1@begi,106,30,0	script	#start_wp1_0	HIDDEN_WARP_NPC,4,4,{
	end;
OnTouch:
	disablenpc();
	donpcevent instance_npcname("#start_wp1_1") + "::OnStart";
	end;

OnInstanceInit:
	'map_begi$ = instance_mapname("1@begi");

	setcell 'map_begi$,146,35,146,41,cell_walkable,0;
	setcell 'map_begi$,154,100,154,107,cell_walkable,0;
	setcell 'map_begi$,59,187,59,197,cell_walkable,0;

	disablenpc instance_npcname("#start_wp1_2");
	disablenpc instance_npcname("#gift");
	end;
}

1@begi,106,30,5	script	#start_wp1_1	4_GEFFEN_03,{
	mes "[Emily]";
	mes "Let's go forward.";
	close;

OnStart:
	npctalk "Emily: So.. is this Poring Village?";
	sleep 2000;
	npctalk "Emily: OK. Let's go!";
	sleep 2000;
	disablenpc();
	donpcevent instance_npcname("#start_wp1_2") + "::OnStart";
	donpcevent instance_npcname("poring_village_1") + "::OnStart";
	end;
}

1@begi,140,37,5	script	#start_wp1_2	4_GEFFEN_03,{
	mes "[Emily]";
	mes "I'm going to start slowly now...";
	close;

OnStart:
	enablenpc();
	sleep 1000;
	npctalk "Emily: Hmmm. It seems they made barriers not to let us go easily.";
	sleep 3000;
	npctalk "Emily: I'm quite sure Poring gathered a lot of treasure somewhere.";
	sleep 4000;
	mapannounce 'map_begi$, "???: I can hear a human's voice. Make them welcome, everybody.", bc_map, 0xFFFF00;
	sleep 4000;
	npctalk "Emily: What is it saying?";
	sleep 3000;
	npctalk "Emily: It sounds someone is rushing here... ";
	sleep 2500;
	mapannounce 'map_begi$, "???: Don't let them run! Take all valuable items from them!", bc_map, 0xFFFF00;
	sleep 2500;
	npctalk "Emily: Well... OK. They don't seem very friendly. Quick, hide!";
	sleep 4000;
	// disablenpc();
	hideonnpc();	// hideonnpc instead of disablenpc (official) to display text on rAthena
	sleep 1000;
	npctalk "Emily: Oooops. Can't you hide? Well..... Cheer up!";
	// disablenpc instance_npcname("#poring_wl18");
	hideonnpc instance_npcname("#poring_wl18");
	specialeffect EF_LORD,AREA, instance_npcname("#poring_wl18");
	sleep 500;
	// disablenpc instance_npcname("#poring_wl19");
	hideonnpc instance_npcname("#poring_wl19");
	specialeffect EF_LORD,AREA, instance_npcname("#poring_wl19");
	sleep 500;
	disablenpc instance_npcname("#poring_wl15");
	sleep 500;
	disablenpc instance_npcname("#poring_wl16");
	disablenpc instance_npcname("#poring_wl17");
	disablenpc instance_npcname("#poring_wl20");
	disablenpc instance_npcname("#poring_wl21");
	setcell 'map_begi$,146,35,146,41,cell_walkable,1;
	end;
}

// First wall
1@begi,146,35,6	duplicate(dummy_npc)	#poring_wl15	4_ROPEPILE,1,0
1@begi,146,36,6	duplicate(dummy_npc)	#poring_wl16	4_ROPEPILE,1,0
1@begi,146,37,6	duplicate(dummy_npc)	#poring_wl17	4_ROPEPILE,1,0
1@begi,146,38,6	duplicate(dummy_npc)	#poring_wl18	4_ROPEPILE,1,0
1@begi,146,39,6	duplicate(dummy_npc)	#poring_wl19	4_ROPEPILE,1,0
1@begi,146,40,6	duplicate(dummy_npc)	#poring_wl20	4_ROPEPILE,1,0
1@begi,146,41,6	duplicate(dummy_npc)	#poring_wl21	4_ROPEPILE,1,0

// Second wall
1@begi,59,187,6	duplicate(dummy_npc)	#poring_wl9	4_ROPEPILE,1,0
1@begi,59,188,6	duplicate(dummy_npc)	#poring_wl10	4_ROPEPILE,1,0
1@begi,59,189,6	duplicate(dummy_npc)	#poring_wl11	4_ROPEPILE,1,0
1@begi,59,190,6	duplicate(dummy_npc)	#poring_wl12	4_ROPEPILE,1,0
1@begi,59,191,6	duplicate(dummy_npc)	#poring_wl13	4_ROPEPILE,1,0
1@begi,59,192,6	duplicate(dummy_npc)	#poring_wl14	4_ROPEPILE,1,0

// Others
1@begi,154,100,6	duplicate(dummy_npc)	#poring_wl1	4_ROPEPILE,1,0
1@begi,154,101,6	duplicate(dummy_npc)	#poring_wl2	4_ROPEPILE,1,0
1@begi,154,102,6	duplicate(dummy_npc)	#poring_wl3	4_ROPEPILE,1,0
1@begi,154,103,6	duplicate(dummy_npc)	#poring_wl4	4_ROPEPILE,1,0
1@begi,154,104,6	duplicate(dummy_npc)	#poring_wl5	4_ROPEPILE,1,0
1@begi,154,105,6	duplicate(dummy_npc)	#poring_wl6	4_ROPEPILE,1,0
1@begi,154,106,6	duplicate(dummy_npc)	#poring_wl7	4_ROPEPILE,1,0
1@begi,154,107,6	duplicate(dummy_npc)	#poring_wl8	4_ROPEPILE,1,0


1@begi,1,1,5	script	poring_village_1	-1,{
	end;
OnStart:
	.@event$ = instance_npcname("poring_village_1") + "::OnMobDead";

	areamonster 'map_begi$, 153,32, 171,32, "--en--", "MD_DROPS",7, .@event$;
	areamonster 'map_begi$, 48,54, 71,57, "--en--", "MD_DROPS",8, .@event$;
	areamonster 'map_begi$, 170,38, 189,38, "--en--", "MD_POPORING",8, .@event$;
	areamonster 'map_begi$, 24,72, 28,92, "--en--", "MD_POPORING",8, .@event$;
	areamonster 'map_begi$, 188,42, 191,58, "--en--", "MD_MARIN",8, .@event$;
	areamonster 'map_begi$, 158,67, 174,68, "--en--", "MD_MARIN",3, .@event$;
	areamonster 'map_begi$, 117,68, 131,68, "--en--", "MD_MARIN",4, .@event$;
	areamonster 'map_begi$, 79,113, 92,113, "--en--", "MD_MARIN",6, .@event$;

	monster 'map_begi$,101,66, "--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,57,113, "--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,68,113, "--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,176,66, "--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,158,68, "--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,157,67, "--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,149,66, "--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,125,67, "--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,121,67, "--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,102,67, "--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,101,68, "--en--","MD_PORING",1, .@event$;
	end;
OnMobDead:
	if (mobcount( 'map_begi$, instance_npcname("poring_village_1") + "::OnMobDead" ) > 3)
		end;
	killmonster 'map_begi$, instance_npcname("poring_village_1") + "::OnMobDead";
	mapannounce 'map_begi$, "Emily: Wow~ You are quite strong! You defeated all these Porings!", bc_map, 0xFFFF00;
	sleep 2000;
	mapannounce 'map_begi$, "Emily: But the Poring looks unique somehow. Be careful!", bc_map, 0xFFFF00;
	sleep 2000;
	mapannounce 'map_begi$, "Emily: Ah, there is a unique force if you go near the column of blue light.", bc_map, 0xFFFF00;
	sleep 2000;
	monster 'map_begi$,132,103,"--en--","MD_GOLDRING",1, instance_npcname("poring_village_1") + "::OnBossDead";
	end;
OnBossDead:
	if (mobcount( 'map_begi$, instance_npcname("poring_village_1") + "::OnBossDead" ) > 0)
		end;
	killmonster 'map_begi$, instance_npcname("poring_village_1") + "::OnBossDead";
	donpcevent instance_npcname("poring_village_2") + "::OnStart";
	sleep 6000;
	// disablenpc instance_npcname("#poring_wl4");
	hideonnpc instance_npcname("#poring_wl4");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl4");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl4");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl4");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl4");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl4");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl4");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl4");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl4");
	// disablenpc instance_npcname("#poring_wl5");
	hideonnpc instance_npcname("#poring_wl5");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl5");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl5");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl5");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl5");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl5");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl5");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl5");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl5");
	disablenpc instance_npcname("#poring_wl1");
	disablenpc instance_npcname("#poring_wl2");
	disablenpc instance_npcname("#poring_wl3");
	disablenpc instance_npcname("#poring_wl6");
	disablenpc instance_npcname("#poring_wl7");
	disablenpc instance_npcname("#poring_wl8");
	setcell 'map_begi$,154,100,154,107,cell_walkable,1;
	end;
}

1@begi,1,1,5	script	poring_village_2	-1,{
	end;
OnStart:
	.@event$ = instance_npcname("poring_village_2") + "::OnMobDead";

	monster 'map_begi$,191,97,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,191,97,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,191,97,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,192,97,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,194,97,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,194,97,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,195,97,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,195,97,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,199,108,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,201,107,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,203,108,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,206,107,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,213,108,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,214,109,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,214,109,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,214,109,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,214,115,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,214,112,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,214,113,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,214,117,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,214,111,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,215,108,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,215,107,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,216,107,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,197,143,"--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,197,143,"--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,192,143,"--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,190,143,"--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,188,143,"--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,188,143,"--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,184,143,"--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,182,143,"--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,157,144,"--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,154,143,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,154,144,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,152,143,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,142,144,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,130,144,"--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,129,144,"--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,127,144,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,120,144,"--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,117,144,"--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,116,144,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,114,143,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,103,144,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,102,144,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,102,144,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,93,143,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,88,144,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,88,144,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,84,144,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,84,144,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,83,143,"--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,76,143,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,75,144,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,73,144,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,73,143,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,72,144,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,69,143,"--en--","MD_POPORING",1, .@event$;
	monster 'map_begi$,64,144,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,59,143,"--en--","MD_PORING",1, .@event$;
	monster 'map_begi$,59,144,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,52,144,"--en--","MD_DROPS",1, .@event$;
	monster 'map_begi$,51,143,"--en--","MD_PORING",1, .@event$;
	end;
OnMobDead:
	if (mobcount( 'map_begi$, instance_npcname("poring_village_2") + "::OnMobDead" ) > 4)
		end;
	killmonster 'map_begi$, instance_npcname("poring_village_2") + "::OnMobDead";
	mapannounce 'map_begi$, "Emily: Hmm.. here is another Boss... It looks strong...", bc_map, 0xFFFF00;
	sleep 2000;
	mapannounce 'map_begi$, "Emily: I'm not good at battle.. Let me look for treasure first. See you soon~", bc_map, 0xFFFF00;
	sleep 2000;
	monster 'map_begi$,42,173,"--en--","MD_AMERING",1, instance_npcname("poring_village_2") + "::OnBossDead";
	end;
OnBossDead:
	if (mobcount( 'map_begi$, instance_npcname("poring_village_2") + "::OnBossDead" ) > 0)
		end;
	killmonster 'map_begi$, instance_npcname("poring_village_2") + "::OnBossDead";
	donpcevent instance_npcname("poring_village_3") + "::OnStart";
	sleep 6000;
	// disablenpc instance_npcname("#poring_wl10");
	hideonnpc instance_npcname("#poring_wl10");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl10");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl10");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl10");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl10");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl10");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl10");
	// disablenpc instance_npcname("#poring_wl13");
	hideonnpc instance_npcname("#poring_wl13");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl13");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl13");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl13");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl13");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl13");
	specialeffect EF_LORD, AREA, instance_npcname("#poring_wl13");
	disablenpc instance_npcname("#poring_wl9");
	disablenpc instance_npcname("#poring_wl11");
	disablenpc instance_npcname("#poring_wl12");
	disablenpc instance_npcname("#poring_wl14");
	setcell 'map_begi$,59,187,59,197,cell_walkable,1;
	end;
}

1@begi,1,1,5	script	poring_village_3	-1,{
	end;
OnStart:
	.@event$ = instance_npcname("poring_village_3") + "::OnMobDead";

	monster 'map_begi$,81,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,84,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,85,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,86,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,87,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,88,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,90,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,93,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,94,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,94,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,95,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,98,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,99,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,103,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,103,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,104,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,108,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,111,197,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,128,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,128,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,130,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,132,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,132,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,132,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,133,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,134,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,135,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,136,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,137,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,141,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,143,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,144,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,144,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,146,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,150,185,"--en--","MD_MARIN",1, .@event$;
	monster 'map_begi$,150,185,"--en--","MD_MARIN",1, .@event$;
	end;
OnMobDead:
	if (mobcount( 'map_begi$, instance_npcname("poring_village_3") + "::OnMobDead" ) > 4)
		end;
	killmonster 'map_begi$, instance_npcname("poring_village_3") + "::OnMobDead";
	mapannounce 'map_begi$, "King Poring: Excuse me... But... Would you please get back now?...", bc_map, 0xFFFF;
	sleep 2000;
	mapannounce 'map_begi$, "Emily: What? Who are you?", bc_map, 0xFFFF00;
	sleep 2000;
	mapannounce 'map_begi$, "King Poring: I am the leader of this Poring Village. Sorry for the late introduction.", bc_map, 0xFFFF;
	sleep 2000;
	mapannounce 'map_begi$, "King Poring: Maybe there is some misunderstanding on our flyers. This village is so poor and has nothing valuable.", bc_map, 0xFFFF;
	sleep 2000;
	mapannounce 'map_begi$, "Emily: It's for me to judge after looking around more....", bc_map, 0xFFFF00;
	sleep 2000;
	mapannounce 'map_begi$, "King Poring: Ugh.... I don't like fighting but there is no choice.", bc_map, 0xFFFF;
	sleep 2000;
	monster 'map_begi$,182,194,"--en--","PORING",10;
	for ( .@i = 0; .@i < 10; ++.@i ) {
		setunitdata $@mobid[.@i], UMOB_MODE, (MD_CANMOVE | MD_LOOTER | MD_AGGRESSIVE | MD_CANATTACK);
		setunitdata $@mobid[.@i], UMOB_SPEED, 200;
	}
	monster 'map_begi$,182,194,"--en--","MD_KING_PORING",1, instance_npcname("poring_village_3") + "::OnBossDead";
	end;
OnBossDead:
	if (mobcount( 'map_begi$, instance_npcname("poring_village_3") + "::OnBossDead" ) > 0)
		end;
	killmonster 'map_begi$, instance_npcname("poring_village_3") + "::OnBossDead";
	enablenpc instance_npcname("#gift");
	end;
}

1@begi,117,108,5	script	Blue Light Column#1	4_ENERGY_BLUE,4,4,{
	end;
OnTouch:
	switch( rand(3) ) {
	case 0:
		unittalk getcharid(3), "" + strcharinfo(0) + " : Ohhhhh!!! Release the parrot inside!!!!";
		break;
	case 1:
		unittalk getcharid(3), "" + strcharinfo(0) + " : I think it's ok to peck someone right now!!";
		break;
	case 2:
		unittalk getcharid(3), "" + strcharinfo(0) + " : Have you been bitten by a mad parrot?";
		break;
	}
	transform 1629,60000;
	specialeffect2 EF_ENHANCE;
	sc_start SC_GLASTHEIM_STATE,30000,20;
	end;
}
1@begi,37,165,5	duplicate(Blue Light Column#1)	Blue Light Column#2	4_ENERGY_BLUE,4,4
1@begi,175,199,5	duplicate(Blue Light Column#1)	Blue Light Column#3	4_ENERGY_BLUE,4,4


1@begi,199,186,5	script	#gift	4_GEFFEN_03,{
	mes "[Emily]";
	mes "You can have all of the items you find in this dungeon. I already have some.";
	next;
	if (isbegin_quest(12418) == 1) {
		mes "[Emily]";
		mes "Ah, I found some items. Let me give you one of them. Just to celebrate your first visit!";
		next;
		if (rand(100) < 50)
			getitem 19238,1;	// PoringTownOnion
		else
			getitem 19239,1;	// PoringTownCarrot
		completequest 12418;
	}
	mes "[Emily]";
	mes "I don't need this novice box. You can take it. Now, let's go out side!";
	close2;
	getitem 23302,1;	// PoringsPreciousBox
	warp "prt_fild05",149,238;
	end;
}