//===== rAthena Script ======================================= 
//= PvP NPCs
//===== By: ==================================================
//= kobra_k88; L0ne_W0lf, Elias (og2)
//===== Current Version: =====================================
//= 2.3
//===== Compatible With: =====================================
//= rAthena SVN
//===== Description: =========================================
//= PvP NPCs that are found in the Inns in major cities.
//= Includes Yoyo Mode, Nightmare Mode, and Event Mode.
//===== Additional Comments: ================================= 
//= 2.0 Narrators/GateKeepers,etc. Translated from the Official 2011 [Elias]
//= 2.1 Changed PVP Narrator and GateKeeper to Floating NPC [Elias]
//= 2.2 Some cleaning. [Euphy]
//= 2.3 Fixed grammatical errors. [Joseph]
//============================================================

-	script	PVP Ա::pvpe	-1,{
	mes "[PVP Ա]";
	mes "ӭӭ!";
	mes "Ϊǽ PVP ģʽ ";
	mes "ҾǽԱ.";
	next;
	switch(select("ʲô PVP?","PVP ģʽ ʲô?","PVPɶ?",".","Ի.")) {
		case 1:
			mes "[PVP Ա]";
			mes "Ҫ˵PVPӢ";
			mes "Player VS PlayerҲ֮ΪӪսģʽ.";
			mes "Ҫ˶Թң";
			mes "PVP.";
			next;
			mes "[PVP Ա]";
			mes "Ǳߵλ";
			mes "^3355FF^000000";
			mes "ȥԿͻȥPVPص.";
			next;
			mes "[PVP Ա]";
			mes "Ҫ͵ȼΪ 31 .";
			mes "ҪһPVPҪ֧ 500 zeny ķ.";
			break;
		case 2:
			mes "[PVP Ա]";
			mes "Ͻ볡صҪ,";
			mes "ôѡһģʽ.";
			mes "ģʽ  ģʽ.";
			next;
			mes "[PVP Ա]";
			mes "ģʽľκηյİ¸¸.";
			mes "ûκγͷŶ PVP .";
			mes "ֻǸոտʼ,Ҫѧϰɵ,";
			mes "ʹģʽ!";
			next;
			mes "[PVP Ա]";
			mes "ģʽΣյ!";
			mes "ҪС,С,СŶ!";
			mes "˻ʧһľֵ!";
			mes ",Ҳһʵϵװ.";
			next;
			mes "[PVP Ա]";
			mes "Ӯ˵Ļ,кཱܶ!";
			mes "Ϊ˱ⲻҪʧ,ҲΪ˱һʱͷԷ,";
			mes "ȥ֮ǰһ,һҪ˼...";
			mes "ô,ף!";
			break;
		case 3:
			mes "[PVP Ա]";
			mes "ṩ PVP ͼ.";
			mes "ȥһ,ѡ!";
			next;
			mes "[PVP Ա]";
			mes "ÿŵͼĽ.";
			mes "ڽв/.";
			next;
			mes "[PVP Ա]";
			mes " PVP ģʽҲرľ.";
			mes "ֻPVPЧ,ûµ.";
			next;
			mes "[PVP Ա]";
			mes "ս볡ص,";
			mes "һ㶼ӵ5.";
			mes "Ӯһ,ͻһ㾭ֵ.";
			next;
			mes "[PVP Ա]";
			mes "һ,˵Ļ...";
			mes "ľֵҲӦ½.";
			mes "ҲܴⰡ!";
			next;
			mes "[PVP Ա]";
			mes "㱻,ľ";
			mes "Сڵ 0 ʱ,";
			mes "ͻ PVP бͳȥ.";
			mes "ζ,ľ!";
			next;
			mes "[PVP Ա]";
			mes ",㱻,Ǿ";
			mes "0,㻹ǿԻð.";
			mes "ҿ԰...";
			mes "?";
			next;
			mes "[PVP Ա]";
			mes "PVP ĸģʽһ,";
			mes "ʽͬ.";
			next;
			mes "[PVP Ա]";
			mes ",һ㻹ע...";
			mes " PVP ,޷.";
			mes "Ǻ...Щ԰ȡʤ.";
			break;
		case 4:
			mes "[PVP Ա]";
			mes "㴢...";
			mes "л֧!";
			mes "ǻټ.";
				if(strnpcinfo(4) == "morocc_in") { savepoint "morocc_in",141,139; }
				if(strnpcinfo(4) == "alberta_in") { savepoint "alberta_in",22,148; }
				if(strnpcinfo(4) == "prt_in") { savepoint "prt_in",54,137; }
				if(strnpcinfo(4) == "geffen_in") { savepoint "geffen_in",70,59; }
				if(strnpcinfo(4) == "payon_in01") { savepoint "payon_in01",142,46; }
			break;
		case 5:
			mes "[PVP Ա]";
			mes "ħĸ,";
			mes "֮ľ - PVP -";
			mes "Ǳøǿ.";
			mes "´!ǻӭʿ!";
			break;
	}
	close;
}

//PVP  Narrator's Duplicates
morocc_in,144,138,4	duplicate(pvpe)	PVP Ա#pe1	84
alberta_in,22,146,4	duplicate(pvpe)	PVP Ա#pe2	84
prt_in,56,140,4	duplicate(pvpe)	PVP Ա#pe3	84
geffen_in,67,63,4	duplicate(pvpe)	PVP Ա#pe4	84
payon_in01,142,50,4	duplicate(pvpe)	PVP Ա#pe5	84
geffen_in,67,63,4	duplicate(pvpe)	PVP Ա#pe6	84

//Gate Keeper (Floating NPC, Locations below)
-	script	::gkut	-1,{
	mes "[]";
	mes "ӭ.";
	mes "ҽΪ㿪 PVP Ĵţ";
	mes "ʲô PVP ģʽ͹⣬";
	mes "ѯԱߵλԱ.";
	next;
	switch(select("^FF5533PvP ģʽ^000000","^3355FFPvP ģʽ^000000","^3355FFPvP ģʽ^000000","Ի")) {
		case 1:
			mes "[]";
			mes "Ǹ,Ŀǰģʽ޷ʹ.";
			mes "ʹģʽ,";
			mes "ܱǸĲ.";
			break;
		case 2:
			mes "[]";
			mes "ķΪ 500 Zeny.";
			mes "Ҫģʽĳ?";
			next;
			if(select("߰","ȥ")==1) {
				if ((Zeny > 499) && (BaseLevel > 30)) {
					set Zeny, Zeny - 500;
					warp "pvp_y_room",51,23;
				}
				else {
					mes "[]";
					mes "Ǹ,δ׼.";
					mes "Ƿ 500 zeny볡.";
					mes "ĵȼҲҪ31";
				}
				close;
			}
			mes "[]";
			mes "ħĸ,";
			mes "֮ľ - PVP -";
			mes "Ǳøǿ.";
			mes "´!ǻӭʿ!";
			close;
		case 3:
			mes "[]";
			mes "ӭ!";
			mes "ͨɻԹȯ.";
			next;
			if ((countitem(7028) == 0) && (countitem(7029) == 0)) {
				mes "[]";
				mes "ûаǸ,";
				mes " PVP ֻЩͨ,";
				mes "ӵԹȯ˿.";
				mes "ûеĻ޷.";
				close;
			}
			mes "[]";
			mes "ǳл֧,ף!";
			warp "pvp_room",51,23;
			break;
		case 4:
			mes "[]";
			mes "ħĸ,";
			mes "֮ľ - PVP -";
			mes "Ǳøǿ.";
			mes "´!ǻӭʿ!";
			break;
	}
	close;
}

//Gate Keeper Duplicates
morocc_in,144,142,4	duplicate(gkut)	#gke1	83
alberta_in,26,146,4	duplicate(gkut)	#gke2	83
prt_in,52,140,4	duplicate(gkut)	#gke3	83
geffen_in,63,63,4	duplicate(gkut)	#gke4	83
payon_in01,140,53,4	duplicate(gkut)	#gke5	83

//Fight square Reception Staff (Locations below)
-	script	FSRS::fsr	-1,{
	if(strnpcinfo(4) == "pvp_y_room") {
		setarray .@Maps$[0],"pvp_y_8-1","pvp_y_8-2","pvp_y_8-3","pvp_y_8-4","pvp_y_8-5";
		setarray .@Name$[0],"¡","˹³","","","޿";
		setarray .@Limit[0],128,128,128,128,128;
	} else {
		setarray .@Maps$[0],"pvp_n_8-1","pvp_n_8-2","pvp_n_8-3","pvp_n_8-4","pvp_n_8-5";
		setarray .@Name$[0],"Sandwich","Lock on","Four Room","Under cross","Compass Room";
		setarray .@Limit[0],64,32,32,32,32;
	}
	for(set .@i,0; .@i<5; set .@i,.@i+1)
		set .@menu$, .@menu$+.@Name$[.@i]+" ["+getmapusers(.@Maps$[.@i])+" / "+.@Limit[.@i]+"]:";
	set .@menu$, .@menu$+"Ի";
	mes "[PVP ְԱ]";
	mes "ѡǰPVPأ";
	set .@i, select(.@menu$)-1;
	if (.@i == 5) close;
	if (getmapusers(.@Maps$[.@i]) >= .@Limit[.@i]) {
		mes "[PVP ְԱ]";
		mes "ǸͼѾﵽ.";
	}
	else warp .@Maps$[.@i],0,0;
	close;

OnInit:
	waitingroom "ѱ",0;
end;
}

//Fight Square Reception Staff
pvp_y_room,86,85,4	duplicate(fsr)	PVP ְԱ#f1	105
pvp_n_room,30,85,4	duplicate(fsr)	PVP ְԱ#f2	105

pvp_n_8-4,33,122,0	warp	Link_1-11	0,2,pvp_n_8-4,0,0
pvp_n_8-4,62,84,0	warp	Link_1-12	1,1,pvp_n_8-4,0,0
pvp_n_8-4,49,71,0	warp	Link_1-21	1,1,pvp_n_8-4,0,0
pvp_n_8-4,56,166,0	warp	Link_1-22	1,1,pvp_n_8-4,0,0
pvp_n_8-4,99,180,0	warp	Link_1-31	2,1,pvp_n_8-4,0,0
pvp_n_8-4,137,84,0	warp	Link_1-32	1,1,pvp_n_8-4,0,0
pvp_n_8-4,150,71,0	warp	Link_1-41	1,1,pvp_n_8-4,0,0
pvp_n_8-4,144,166,0	warp	Link_1-42	1,1,pvp_n_8-4,0,0
pvp_n_8-5,30,30,0	warp	Link_1-99	3,3,pvp_n_8-5,100,100

// Event Contestant Entrance
//============================================================ 
pvp_room,54,85,4	script	ǩԱ#1	105,{
	if (countitem(7028) == 0) {
		mes "[PVP սǩԱ]";
		mes "ô?";
		mes "ֻԲս߿.";
		mes "Ҫ֪ĻϸѯҷעԱ.";
		close;
	}

	if (.pvp_close_n_room == 1 && .pvp_close_s_room == 1 && .pvp_close_w_room == 1 && .pvp_close_e_room == 1) {
		Set .pvp_close_n_room,0;
		Set .pvp_close_s_room,0;
		Set .pvp_close_w_room,0;
		Set .pvp_close_e_room,0;
	}

	if (select("սһ :ȡ") == 1) {
		mes "[PVP սǩԱ]";
		mes "'"+ strcharinfo(0) +"'";
		mes "׼?!";
		next;
		if (select("Yes!:No!") == 1) {
			mes "[PVP սǩԱ]";
			mes "õģͽȥ.";
			mes "ף!";
			close2;
			delitem 7028,1; //Invite_For_Duel
			while(1) {
				switch(rand(1,4)) {
				case 1:
					if (.pvp_close_n_room == 0) {
						set .pvp_close_n_room,1;
						warp "pvp_2vs2",40,59;
						end;
					}
				case 2:
					if (.pvp_close_s_room == 0) {
						set .pvp_close_s_room,1;
						warp "pvp_2vs2",59,40;
						end;
					}
				case 3:
					if (.pvp_close_w_room == 0) {
						set .pvp_close_w_room,1;
						warp "pvp_2vs2",20,40;
						end;
					}
				case 4:
					if (.pvp_close_e_room == 0) {
						set .pvp_close_e_room,1;
						warp "pvp_2vs2",40,20;
						end;
					}
				}
			}
		}
		mes "[PVP սǩԱ]";
		mes "׼˾Ұ.";
		close;
	}
	close;

OnInit:
	Set .pvp_close_n_room,0;
	Set .pvp_close_s_room,0;
	Set .pvp_close_w_room,0;
	Set .pvp_close_e_room,0;
	waitingroom "սר",0;
	end;
}

// Spectator Entrance
//============================================================ 
-	script	ڵԱ#dum::PVPSpectator	-1,{
	if (countitem(7029) == 0) {
		mes "[PVP սԱ]";
		mes "ǹڴ.";
		mes "սڹ󷽵ǩԱ.";
		close;
	}

	if (select("սһ:ȡ") == 1) {
		mes "[PVP սԱ]";
		mes "õģл֧֣ף!";
		close2;
		delitem 7029,1; //Admission_For_Duel
		switch(rand(1,4)) {
		case 1: warp "pvp_2vs2",39,7; end;
		case 2: warp "pvp_2vs2",39,73; end;
		case 3: warp "pvp_2vs2",7,39; end;
		case 4: warp "pvp_2vs2",73,39; end;
		}
	}
	close;

OnInit:
	waitingroom "ר",0;
	end;
}

pvp_room,62,85,4	duplicate(PVPSpectator)	ڵԱ#1	105
pvp_room,70,85,4	duplicate(PVPSpectator)	ڵԱ#2	105
pvp_room,78,85,4	duplicate(PVPSpectator)	ڵԱ#3	105
pvp_room,86,85,4	duplicate(PVPSpectator)	ڵԱ#4	105

// Spectator Warps
//============================================================ 
-	script	սְԱ#dum::PVPSpecWarp	-1,{
OnTouch:
	mes "[սְԱ]";
	mes "Ҫʲô?";
	if (select("ϯ.:뿪ս.") == 1) {
		warp "pvp_2vs2",38,38;
		end;
	}
	warp "pvp_room",84,39;
	end;
}

pvp_2vs2,5,4,0	duplicate(PVPSpecWarp)	սְԱ#1	45,1,1
pvp_2vs2,5,74,0	duplicate(PVPSpecWarp)	սְԱ#2	45,1,1
pvp_2vs2,74,74,0	duplicate(PVPSpecWarp)	սְԱ#3	45,1,1
pvp_2vs2,74,5,0	duplicate(PVPSpecWarp)	սְԱ#4	45,1,1

pvp_2vs2,40,40,0	script	սְԱ#5	45,1,1,{
	mes "[սְԱ]";
	mes "Ҫʲô?";
	if (select("ȥϯԵ.:뿪ս.") == 1)
		switch(rand(1,4)) {
		case 1: warp "pvp_2vs2",39,7; end;
		case 2: warp "pvp_2vs2",39,73; end;
		case 3: warp "pvp_2vs2",7,39; end;
		case 4: warp "pvp_2vs2",73,39; end;
		}
	warp "pvp_c_room",84,39;
	end;
}

// PVP Area Exit warp
//============================================================ 
pvp_room,51,19,0	script	#eventpvp	45,4,2,{
OnTouch:
	mes "[սְԱ]";
	mes "Ŀ?";
	mes "Ǻǣȥ?";
	next;
	switch(select("¡:޿::::ȡ")) {
	case 1: warp "prontera",107,60; end;
	case 2: warp "morocc",157,96; end;
	case 3: warp "geffen",120,36; end;
	case 4: warp "payon",96,100; end;
	case 5: warp "alberta",41,243; end;
	case 6: close;
	}
}
