//===== rAthena Script ======================================= 
//= Cash Shop Functions
//===== By: ================================================== 
//= L0ne_W0lf
//===== Current Version: ===================================== 
//= 1.8
//===== Compatible With: ===================================== 
//= rAthena Project
//===== Description: ========================================= 
//= Used for Cash shop items:
//= - Kafra Card
//= - Giant Fly Wing
//= - Neuralizer
//= - Dungeon Teleport Scroll
//= Also included are functions related to the VIP system.
//===== Additional Comments: ================================= 
//= 1.0 First version. [L0ne_W0lf]
//=     F_CashPartyCall Optimized by Trancid.
//= 1.1 Updated Dungeon Teleport Scroll. [L0ne_W0lf]
//=     Added Town Teleport Scroll Function
//=     Added Seige Teleport Scroll Function
//= 1.2 Updated the dungeon teleport scroll menu. [L0ne_w0lf]
//= 1.3 Implemented Aozi Giant Flywing Fix. (bugreport:4242) [L0ne_w0lf]
//= 1.4 Simplified Giant Flywing function using warpparty. [L0ne_w0lf]
//= 1.5 Neuralizer is no longer consumed upon failure. [Euphy]
//= 1.6 Updated Teleport functions and added Curious_Snowball. [Euphy]
//= 1.7 Added Dungeon Teleport Scroll II maps. [Euphy]
//= 1.8 Added VIP function. [Euphy]
//============================================================ 

// زֿʹȯ
//============================================================ 
// - ʱش򿪲ֿ
// - ޲
function	script	F_CashStore	{
	cutin "kafra_01",2;
	mes "[ ְԱ]";
	mes ",ӭп˾!";
	mes "ڽֿ.";
	close2;
	openstorage;
	cutin "",255;
	return;
}


// ޴Ӭ
//============================================================ 
// - Warp party leader to random spot on the map.
// - ŵͼϵĶӳһ˲ƶ
// - ޲.
function	script	F_CashPartyCall	{
	warp "Random",0,0;
	if(getpartyleader(getcharid(1),2) == getcharid(0)) {
		getmapxy .@mapl$, .@xl, .@yl, 0;
		warpparty .@mapl$, .@xl, .@yl, getcharid(1), .@mapl$;
	}
	return;
}

// üܰ
//============================================================ 
// - Ϊ0,ӥƳ
// - ޲
function	script	F_CashReset	{
	if (Class != Job_Novice && Weight == 0 && !checkriding() && !checkfalcon() && !checkcart() && !ismounting()) {
		resetskill;
		sc_end SC_ALL;
		if (countitem(12213)) delitem 12213,1;
	}
	return;
}

// Ѩ˲ƶ 
//============================================================ 
// - Warp player to the selected dungeon.
// - Arg(0) = type of scroll.
function	script	F_CashDungeon	{
	switch(getarg(0)) {
	case 1:
		switch(select("ŵ޵: :"+((checkre(0))?"":"ľ ͨ·")+":޿˿ɽѨ:·:߹ֿ:˹غķ ¼1¥:֮:ɵΧ̨:˹³õضѨ:ڹ굺Ѩ: 3¥: 3¥:ų ˮ2¥:ʷҿ˹ Ѩ4¥: Թ4¥:¡ ˮ3¥:  Թ1¥: о1¥:Ӵ̩ Ŵ2¥")) {
		case 1: warp "mag_dun01",125,71; end;	// ŵ޵
		case 2: warp "mjo_dun02",80,297; end;	//  
		case 3: warp "um_dun02",125,122; end;	// ľͨ· (Pre-Renewal only)
		case 4: warp "ein_dun01",261,262; end;	// ޿˿ɽѨ
		case 5: warp "pay_dun03",155,150; end;	// ·
		case 6: warp "xmas_dun01",133,130; end;	// ߹ֿ
		case 7: warp "gl_prison",140,15; end;	// ˹غķ ¼1¥
		case 8: warp "lou_dun03",165,38; end;	// ֮
		case 9: warp "gon_dun02",251,263; end;	// ɵΧ̨
		case 10: warp "iz_dun02",350,335; end;	// ˹³õضѨ
		case 11: warp "tur_dun02",165,30; end;	// ڹ굺Ѩ
		case 12: warp "alde_dun03",275,180; end;	//  3¥
		case 13: warp "c_tower3",34,42; end;	//  3¥
		case 14: warp "gl_sew02",292,295; end;	// ų ˮ2¥
		case 15: warp "in_sphinx4",120,120; end;	// ʷҿ˹ Ѩ4¥
		case 16: warp "moc_pryd04",195,4; end;	//  Թ4¥
		case 17: warp "prt_sewb3",20,175; end;	// ¡ ˮ3¥
		case 18: warp "ama_dun01",222,144; end;	//   Թ1¥
		case 19: warp "lhz_dun01",19,153; end;	//  о1¥
		case 20: warp "ayo_dun02",70,240; end;	// Ӵ̩ Ŵ2¥
		}
	case 2: // Menu names are not official.
		switch(select("жɽ 2f:::ƺķ:Թɭ 2f:˹Ѩ:ϵ 2f:ѧԺ:˹:Ԩˮ:Ǵ:µ 2f")) {
		case 1: warp "thor_v02",77,208; end;	// Thor Volcano 2F
		case 2: warp "ra_fild01",237,333; end;	// Ice Dungeon
		case 3: warp "ve_fild07",127,131; end;	// Nameless Island
		case 4: warp "niflheim",206,179; end;	// Niflheim
		case 5: warp "prt_maze02",100,174; end;	// Labyrinth Forest F2
		case 6: warp "jupe_cave",36,54; end;	// Juperos
		case 7: warp "anthell02",36,265; end;	// Ant Hell F2
		case 8: warp "yuno_fild08",70,171; end;	// Kiel Hyre's Academy
		case 9: warp "hu_fild01",140,160; end;	// Thanatos Tower
		case 10: warp "hu_fild05",168,302; end;	// Abyss Lake
		case 11: warp "ra_temple",117,173; end;	// Rachel Sanctuary
		case 12: warp "odin_tem02",257,374; end;	// Odin Temple F2
		}
	case 3:
		switch(select(" о (2¥):Ѩ (3¥):¶ (3¥):жɽ Ѩ (3¥):Ԩˮ ¶Ѩ (3¥):˹  (2¥)")) {
		case 1: warp "lhz_dun02",145,149; end;	//  о 2¥
		case 2: warp "ice_dun03",150,176; end;	// Ѩ 3¥
		case 3: warp "odin_tem03",278,235; end;	// ¶ 3¥
		case 4: warp "thor_v03",144,170; end;	// жɽ Ѩ 3¥
		case 5: warp "abyss_03",97,104; end;	// Ԩˮ ¶Ѩ 3¥
		case 6: warp "juperos_02",130,159; end;	// ˹  2¥
		}
	}
	return;
}

// Coloured Butterly Wings
//============================================================ 
// - Warp player to different cities acording to the scroll.
// - Arg(0) = type of scroll.
function	script	F_CashCity	{
	switch(getarg(0)) {
	case 1: // Yellow - Rune-Midgart
		switch(select("¡:˹³õ:::޿::")) {
			case 1: warp "prontera",122,87; end;
			case 2: if (checkre(0)) warp "izlude",130,90; else warp "izlude",91,105; end;
			case 3: warp "geffen",128,48; end;
			case 4: warp "payon",164,123; end;
			case 5: warp "morocc",160,100; end;
			case 6: warp "alberta",117,50; end;
			case 7: warp "aldebaran",140,110; end;
		}
	case 2: // Green - Schwartzvalt
		switch(select("ŵ:ϣ:޿::ٸ")) {
			case 1: warp "yuno",160,170; end;
			case 2: warp "lighthalzen",190,310; end;
			case 3: warp "einbroch",230,190; end;
			case 4: warp "einbech",187,120; end;
			case 5: warp "hugel",92,165; end;
		}
	case 3: // Red - Arunafeltz
		switch(select(":˹")) {
			case 1: warp "rachel",120,125; end;
			case 2: warp "veins",215,105; end;
		}
	case 4: // Blue - Islands
		switch(select("::Ӵ̩:֮")) {
			case 1: warp "amatsu",110,140; end;
			case 2: warp "gonryun",160,115; end;
			case 3: warp "ayothaya",220,170; end;
			case 4: warp "louyang",217,95; end;
		}
	case 5: // Blue - Islands (Renewal)
		switch(select("::Ӵ̩:֮:Ī˹Ʊ::˹")) {
			case 1: warp "amatsu",110,140; end;
			case 2: warp "gonryun",160,115; end;
			case 3: warp "ayothaya",220,170; end;
			case 4: warp "louyang",217,95; end;
			case 5: warp "moscovia",224,195; end;
			case 6: warp "dewata",200,107; end;
			case 7: warp "brasilis",196,181; end;
		}
	}
	return;
}

// ռƶ
//============================================================ 
// - ʹߴ͵ѡĳ.
// - Arg(0) = type of scroll.
function	script	F_CashTele	{
	switch(getarg(0)) {
	case 1:
		switch(select("¡:::˹³õ:")) {
		case 1: warp "prontera",119,77; end;
		case 2: warp "geffen",119,39; end;
		case 3: warp "aldebaran",165,107; end;
		case 4: if (checkre(0)) warp "izlude",128,105; else warp "izlude",91,105; end;
		case 5: warp "SavePoint",0,0; end;
		}
	case 2:
		switch(select("::޿:ħ:")) {
		case 1: warp "payon",158,55; end;
		case 2: warp "alberta",115,57; end;
		case 3: warp "morocc",158,48; end;
		case 4: warp "comodo",217,148; end;
		case 5: warp "SavePoint",0,0; end;
		}
	case 3:
		switch(select("֮:::Ӵ̩:")) {
		case 1: warp "louyang",214,101; end;
		case 2: warp "amatsu",112,145; end;
		case 3: warp "gonryun",160,118; end;
		case 4: warp "ayothaya",216,175; end;
		case 5: warp "SavePoint",0,0; end;
		}
	case 4:
		switch(select("::ܽķ:")) {
		case 1: warp "xmas",148,131; end;
		case 2: warp "umbala",93,154; end;
		case 3: warp "niflheim",187,189; end;
		case 4: warp "SavePoint",0,0; end;
		}
	case 5:
		switch(select("ŵ:޿:ϣ:ٸ:")) {
		case 1: warp "yuno",157,124; end;
		case 2: warp "einbroch",230,192; end;
		case 3: warp "lighthalzen",158,94; end;
		case 4: warp "hugel",93,159; end;
		case 5: warp "SavePoint",0,0; end;
		}
	case 6:
		switch(select(":˹:")) {
		case 1: warp "rachel",118,132; end;
		case 2: warp "veins",214,125; end;
		case 3: warp "SavePoint",0,0; end;
		}
	}
	return;
}

// Siege Teleport Scroll
//============================================================ 
// - Warp player to selected guild castle.
// - No arguments.
function	script	F_CashSiegeTele	{
	switch(select("¶  (aldeg_cas01):¶  (aldeg_cas02):¶  (aldeg_cas03):¶  (aldeg_cas04):¶ɹ (aldeg_cas05):  (gefg_cas01):  (gefg_cas02):  (gefg_cas03):  (gefg_cas04):  (gefg_cas05):ֺ  (payg_cas01):ֺ  (payg_cas02):ֺ  (payg_cas03):ֺ  (payg_cas04):ֺ  (payg_cas05):Kriemhild (prtg_cas01):ͻ׶  (prtg_cas02):ͻ׶  (prtg_cas03):ͻ׶  (prtg_cas04):ͻ׶  (prtg_cas05)")) {
	case 1: warp "alde_gld",48,91; end;
	case 2: warp "alde_gld",103,245; end;
	case 3: warp "alde_gld",142,87; end;
	case 4: warp "alde_gld",236,243; end;
	case 5: warp "alde_gld",269,90; end;
	case 6: warp "gef_fild13",217,75; end;
	case 7: warp "gef_fild13",307,237; end;
	case 8: warp "gef_fild13",77,297; end;
	case 9: warp "gef_fild13",190,276; end;
	case 10: warp "gef_fild13",312,91; end;
	case 11: warp "pay_gld",121,232; end;
	case 12: warp "pay_gld",297,116; end;
	case 13: warp "pay_gld",318,293; end;
	case 14: warp "pay_gld",140,164; end;
	case 15: warp "pay_gld",202,264; end;
	case 16: warp "prt_gld",141,64; end;
	case 17: warp "prt_gld",240,131; end;
	case 18: warp "prt_gld",153,133; end;
	case 19: warp "prt_gld",126,240; end;
	case 20: warp "prt_gld",195,240; end;
	}
	return;
}

// Curious Snowball
//============================================================ 
// - You can get an effect of Restore, Endure, or Wing of Butterfly.
// - No arguments.
function	script	F_Snowball	{
	cutin "rutie_snownow03",2;
	mes "[ѩ]";
	mes "ʥڿ!";
	switch(select("ָһЩ HP/SP:ǿҵ״̬!:SPȫظ.:ش")) {
	case 1:
		mes "!";
		mes "ҹ~";
		percentheal 70,70;
		close2;
		cutin "",255;
		break;
	case 2:
		mes "ף.";
		mes "ʥ֮ҹ~";
		unitskilluseid getcharid(3),"SM_ENDURE",10;
		close2;
		cutin "",255;
		break;
	case 3:
		mes "!";
		mes "ɫҮ~";
		percentheal 0,100;
		close2;
		cutin "",255;
		break;
	case 4:
		mes "춣~";
		mes "춣~ 춣!";
		close2;
		cutin "",255;
		warp "SavePoint",0,0;
		break;
	}
	end;
}

// VIP Functions
//============================================================ 
function	script	VIP_Third_Class	{
	if (!vip_status(1)) {
		mes "[Voice from nowhere]";
		mes "Access to Premium content is only available to those who possess a certain amount of Reset Stones.";
		next;
		if (countitem(6320) < 1) {
			mes "[Voice from nowhere]";
			mes "In order to change to third class, you must bring 1 ^0000CCReset Stone^000000 or have a Premium account.";
			//mes "Please visit our iShop to purchase the ^0000CCReset Stone^000000.";
			close;
		} else {
			mes "[Voice from nowhere]";
			mes "Would you like to participate in this quest for 1 ^0000CCReset Stone^000000?";
			next;
			switch(select("Yes:No")) {
			case 1:
				mes "[Voice from nowhere]";
				mes "Good luck, adventurer.";
				delitem 6320,1; //Premium_Reset_Stone
				break;
			case 2:
				mes "[Voice from nowhere]";
				mes "Very well.";
				close;
			}
		}
	}
	return;
}
