//===== eAthena Script =======================================
//= Turbo Track NPCs
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.4
//===== Compatible With: =====================================
//= eAthena SVN
//===== Description: ========================================= 
//= [Aegis Conversion]
//= General Turbo Track NPCs, includes Kafra and Tool Merchant
//===== Additional Comments: =================================
//= 1.0 First version. [L0ne_W0lf]
//= 1.1 Fixed exp rewarding working backwards.[L0ne_W0lf]
//=	Fixed a bug in the while loop in the guide.
//= 1.2 Fix to prevent point converter from hanging. [L0ne_W0lf]
//= 1.3 Slight optimization to the point exchanger. [L0ne_W0lf]
//= 1.4 Added missing checkweights. [L0ne_W0lf]
//============================================================

turbo_room,130,92,3	script	Kafra Staff#tt	115,{
	cutin "kafra_03",2;
	mes "[Kafra Staff]";
	mes "Welcome~ The Kafra Services";
	mes "are always on your side. Let me";
	mes "remind you that using the Save";
	mes "Service here will change your";
	mes "Respawn Point to Al De Baran.";
	mes "Now, how may I assist you?";
	callfunc "F_Kafra",5,8,1,40,0;

	M_Save:
		savepoint "aldebaran",168,112;
		callfunc "F_KafEnd",0,1,"in Al De Baran";

}

turbo_room,124,86,0	shop	Turbo Track Merchant	90,501:-1,502:-1,503:-1,504:-1,645:-1,656:-1,1065:-1,1750:-1

//This is the name on iRO as well. [Confirmed]
turbo_room,99,120,4	script	TBT_Guide#Broadcast	124,{
	mes "[Turbo Track Guide]";
	mes "Good day~";
	mes "Is there anything that";
	mes "you would like to know";
	mes "about the Turbo Track?";
	mes "Feel free to ask me";
	mes "any questions.";
	next;
	while(1) {
		switch(select("Race Rules:Game Courses:Game Modes:Prohibited Items and Skills:Cancel")) {
		case 1:
			mes "[Turbo Track Guide]";
			mes "The rules for all the races";
			mes "are pretty simple. Just get";
			mes "past all the obstacles and";
			mes "try to get to the Finish Line";
			mes "as quickly as you can.";
			next;
			mes "[Turbo Track Guide]";
			mes "Of course, some of the courses";
			mes "in the races may present a few";
			mes "unexpected situations, but I can't really illustrate an example...";
			mes "Just know that there will";
			mes "be traps lying about.";
			next;
			mes "[Turbo Track Guide]";
			mes "Classes that can mount";
			mes "a Peco Peco, such as Knight,";
			mes "Lord Knight, Crusader and";
			mes "Paladin, must get off their";
			mes "Peco Pecos before entering";
			mes "the Turbo Track Arena.";
			next;
			mes "[Turbo Track Guide]";
			mes "Well, more accurately,";
			mes "someone at the Turbo Track";
			mes "entrance will ask you to get";
			mes "off and will give you a ticket";
			mes "so that you can rent your";
			mes "Peco again free of charge.";
			next;
			mes "[Turbo Track Guide]";
			mes "Now, the winner of the race";
			mes "is the person who reaches the";
			mes "Finish Line first. Once someone";
			mes "crosses the Finish Line, the race ends and everyone is automatically transported to a Waiting Room.";
			next;
			mes "[Turbo Track Guide]";
			mes "Keep in mind that every";
			mes "race is only 15 minutes long.";
			mes "If no one can reach the Finish";
			mes "Line within that time, the race";
			mes "will end without a winner.";
			next;
			mes "[Turbo Track Guide]";
			mes "There are no character";
			mes "class or level requirements";
			mes "to participate in the Turbo";
			mes "Track. However, there is a";
			mes "participation fee of 1,000 zeny. ^FFFFFFcobo^000000";
			next;
			break;
		case 2:
			mes "[Turbo Track Guide]";
			mes "Races in the Turbo Track";
			mes "consist of various courses:";
			mes "^4d4dffLog Bridge, Cube Hills, the";
			mes "Single Snail, Snake Dice, Small";
			mes "Cave and the Invisible Maze.";
			next;
			mes "[Turbo Track Guide]";
			mes "The availability of specific";
			mes "courses is determined by the";
			mes "game mode. Would you like to";
			mes "learn more about a certain course? ^FFFFFFcobo^000000";
			next;
			set .@exitloop,1;
			while (.@exitloop) {
				switch(select("Log Bridge and Cube Hills:Cursed Desert and Flasher Maze:Single Snail and Invisible Maze:Snake Dice and Small Cave:No, thanks.")) {
				case 1:
					mes "[Turbo Track Guide]";
					mes "In the Log Bridge";
					mes "course, you must cross";
					mes "over a single log. If you";
					mes "fall off, you'll be brought";
					mes "back to the beginning of";
					mes "the Log Bridge.";
					next;
					mes "[Turbo Track Guide]";
					mes "The Cube Hills is a maze";
					mes "consisting of piles and piles";
					mes "of boxes. You can climb over";
					mes "some boxes, but cannot pass";
					mes ",through others. You'll have to navigate and find the best path.";
					next;
					break;
				case 2:
					mes "[Turbo Track Guide]";
					mes "The Cursed Desert is";
					mes "a short course that is full";
					mes "of surprises. If you're really";
					mes "unlucky, you may find yourself";
					mes "confused or even cursed!";
					next;
					mes "[Turbo Track Guide]";
					mes "The Flasher Maze";
					mes "is full of traps that will";
					mes "blind so you better be extra";
					mes "careful in navigating this maze. It might be wiser to try to slow down and avoid the traps...";
					next;
					break;
				case 3:
					mes "[Turbo Track Guide]";
					mes "The Single Snail is";
					mes "a narrow, spiral path";
					mes "shaped like a snail's shell.";
					mes "There aren't many obstacles,";
					mes "but it will be tough to race at your top speed in this course.";
					next;
					mes "[Turbo Track Guide]";
					mes "The Invisible Maze";
					mes "looks like a huge, open";
					mes "room, but it's actually full";
					mes "of invisible walls. You'll";
					mes "be given some hints, so";
					mes "it's not impossible.";
					next;
					break;
				case 4:
					mes "[Turbo Track Guide]";
					mes "The Snake Dice course";
					mes "offers winding paths, much";
					mes "like the body of a snake. The";
					mes "factor of luck also plays a role in this course, which you'll";
					mes "have to see for yourself.";
					next;
					mes "[Turbo Track Guide]";
					mes "The Small Cave is simply";
					mes "a replica of the Payon Cave.";
					mes "This part should be a breeze";
					mes "if you're pretty comfortable with hunting in the Payon Cave.";
					next;
					break;
				case 5:
					mes "[Turbo Track Guide]";
					mes "I see.";
					mes "Okay then,";
					mes "best of luck to";
					mes "you in the races!";
					next;
					set .@exitloop,0;
				}
			}
			mes "[Turbo Track Guide]";
			mes "Would you like to";
			mes "know anything else";
			mes "about Turbo Track?";
			next;
			break;
		case 3:
			mes "[Turbo Track Guide]";
			mes "There are three different";
			mes "game modes available for";
			mes "races in the Turbo Track:";
			mes "Normal, Expert and Solo.";
			next;
			mes "[Turbo Track Guide]";
			mes "Unlike the other game";
			mes "modes, ^4d4dffExpert Mode";
			mes "allows players to PvP^000000. This mode";
			mes "is ideal for races between";
			mes "parties or guilds.";
			next;
			mes "[Turbo Track Guide]";
			mes "Now, the Invisible Maze is";
			mes "a special course that is only";
			mes "available in 16 person races";
			mes "in ^4d4dffNormal^000000 and ^4D4DFFExpert^000000 modes.";
			next;
			mes "[Turbo Track Guide]";
			mes "If you play Solo Mode,";
			mes "you can experience every";
			mes "course, and the name of time";
			mes "of the fastest player will be";
			mes "recorded in our Hall of Honor.";
			next;
			break;
		case 4:
			mes "[Turbo Track Guide]";
			mes "Now in Turbo Track, the";
			mes "following items are prohibited";
			mes "from use: Green Potion, Panacea";
			mes "and Fly Wing. If you do try to use them, they won't work until after you leave the race track.";
			next;
			mes "[Turbo Track Guide]";
			mes "The following skills cannot";
			mes "be used during Turbo Track";
			mes "races: Snatch, Teleport, Warp";
			mes "Portal, Hiding, Cloaking, Stealth, Cure, Ice Wall, Berserk, Basilica, Sheltering Bless and Spear Dynamo.";
			next;
			//this aopears to suposed to fall through.
		case 5:
			mes "[Turbo Track Guide]";
			mes "Please enjoy your";
			mes "time in the Al De Baran";
			mes "Turbo Track. Thank you~";
			close;
		}
	}

OnInit:
	// This will only ever be run ONCE!
	// Unless you eradicate the variable.
	//
	// This OnInit initiallizes and sets the starting
	// data for the Turbo Track's "Record" Logs.
	// WARNING/ATTENTION: DO NOT MODIFY ANY OF THE DATA.
	// DOING SO WILL CAUSE INTERNAL PROBLEMS IN THE SCRIPT.
	if ($ttnames$[0] == "") {
		setarray $ttnames$[0],"Breezy Havana";	// Solo Mode/Time Attack
		setarray $ttnames$[1],"RS125";	// Normal 4 Player
		setarray $ttnames$[2],"Hollgrehenn";	// Normal 8 Players
		setarray $ttnames$[3],"Antonio";	// Noomal 16 Players

		setarray $ttnames$[4],"Aragham";	// Expert 4 Players
		setarray $ttnames$[5],"Kafra Jasmine";	// Expert 8 Players
		setarray $ttnames$[6],"Chris";	// Expert 16 Players

		setarray $ttnames$[7],"Breezy Havana";	// Honor Place 1
		setarray $ttnames$[8],"RS125";	// Honor Place 2

		setarray $ttnames$[9],"Breezy Havana";	// Top 1
		setarray $ttnames$[10],"Nari";	// Top 2
		setarray $ttnames$[11],"Senorita Sylvia";	// Top 3
		setarray $ttnames$[12],"Joo Jahk";	// Top 4
		setarray $ttnames$[13],"RS125";	// Top 5

		setarray $ttranks[0],999999,0,0,0,0,0;
	}
	end;

Onend_n1:
	mapannounce "turbo_room","A [Normal Mode - Solo] game will end shortly.",bc_map,"0xadff2f";
	end;

Onend_n4:
	mapannounce "turbo_room","A [Normal Mode - 4 Person] game will end shortly.",bc_map,"0xadff2f";
	end;

Onend_n8:
	mapannounce "turbo_room","A [Normal Mode - 8 Person] game will end shortly.",bc_map,"0xadff2f";
	end;

Onend_n16:
	mapannounce "turbo_room","A [Normal Mode - 16 Person] game will end shortly.",bc_map,"0xadff2f";
	end;

Onend_e4:
	mapannounce "turbo_room","A [Expert Mode - 4 Person] game will end shortly.",bc_map,"0xadff2f";
	end;

Onend_e8:
	mapannounce "turbo_room","A [Expert Mode - 8 Person] game will end shortly.",bc_map,"0xadff2f";
	end;

Onend_e16:
	mapannounce "turbo_room","A [Expert Mode - 16 Person] game will end shortly.",bc_map,"0xadff2f";
	end;

Onnew_top1:
	mapannounce "turbo_room","Congratulations! " + $ttnames$[9] + " has ranked Number One in the Turbo Track Hall of Honor!",bc_map,"0x00ff00";
	end;

Onnew_top2:
	mapannounce "turbo_room","Congratulations! " + $ttnames$[10] + " has ranked Second in the Turbo Track Hall of Honor!",bc_map,"0x00ff00";
	end;

Onnew_top3:
	mapannounce "turbo_room","Congratulations! " + $ttnames$[11] + " has ranked Third in the Turbo Track Hall of Honor!",bc_map,"0x00ff00";
	end;

Onnew_top4:
	mapannounce "turbo_room","Congratulations! " + $ttnames$[12] + " has ranked Fourth in the Turbo Track Hall of Honor!",bc_map,"0x00ff00";
	end;

Onnew_top5:
	mapannounce "turbo_room","Congratulations! " + $ttnames$[13] + " has ranked Fifth in the Turbo Track Hall of Honor!",bc_map,"0x00ff00";
	end;

Onwin_n4:
	mapannounce "turbo_room","Congratulations! " + $ttnames$[1] + " just won a [Normal Mode - 4 Person] game!",bc_map,"0x70DBDB";
	end;

Onwin_n8:
	mapannounce "turbo_room","Congratulations! " + $ttnames$[2] + " just won a [Normal Mode - 8 Person] game!",bc_map,"0x70DBDB";
	end;

Onwin_n16:
	mapannounce "turbo_room","Congratulations! " + $ttnames$[3] + " just won a [Normal Mode - 16 Person] game!",bc_map,"0x70DBDB";
	end;

Onwin_e4:
	mapannounce "turbo_room","Congratulations! " + $ttnames$[4] + " just won an [Expert Mode - 4 Person] game!",bc_map,"0x70DBDB";
	end;

Onwin_e8:
	mapannounce "turbo_room","Congratulations! " + $ttnames$[5] + " just won an [Expert Mode - 8 Person] game!",bc_map,"0x70DBDB";
	end;

Onwin_e16:
	mapannounce "turbo_room","Congratulations! " + $ttnames$[6] + " just won an [Expert Mode - 16 Person] game!",bc_map,"0x70DBDB";
	end;
}

turbo_room,102,117,3	script	Hall of Honor#tt	857,{
	mes "^2F4F4FTurbo Track Hall of Honor^000000";
	mes " ";
	mes "The First:";
	mes "^4d4dff" + $ttnames$[7] + "^000000";
	mes " ";
	mes "The Last:";
	mes "^4d4dff" + $ttnames$[8] + "^000000";
	close;
}

turbo_room,77,115,5	script	Solo Mode#tt::TurboSoloNames	857,{
	mes "^2F4F4FSolo Mode Record^000000";
	mes " ";
	mes "The best player";
	mes "in Solo Mode...";
	mes "^4d4dff" + $ttnames$[0] + "^000000 !";
	close;
}

turbo_room,87,114,5	script	Normal Mode Record#tt::TurboNormalNames	857,{
	mes "<<Recent Top Players>>";
	mes "Winners of Normal Mode - 4 Person";
	mes "^4d4dff" + $ttnames$[1] + "^000000";
	mes "Winners of Normal Mode - 8 Person";
	mes "^4d4dff" + $ttnames$[2] + "^000000";
	mes "Winners of Normal Mode - 16 Person";
	mes "^4d4dff" + $ttnames$[3] + "^000000";
	close;
}

turbo_room,112,114,3	script	Expert Mode Record::TurboExpertNames	857,{
	mes "<<Recent Top Players>>";
	mes "Winners of Expert Mode - 4 Person";
	mes "^4d4dff" + $ttnames$[4] + "^000000";
	mes "Winners of Expert Mode - 8 Person";
	mes "^4d4dff" + $ttnames$[5] + "^000000";
	mes "Winners of Expert Mode - 16 Person";
	mes "^4d4dff" + $ttnames$[6] + "^000000";
	close;
}

turbo_room,97,117,5	script	Hall of Honor#tt2	857,{
	mes "^2F4F4FTurbo Track Hall of Honor^000000";
	mes " ";
	mes "1st: ^4d4dff" + $ttnames$[9] + "^000000";
	mes "2nd: ^4d4dff" + $ttnames$[10] + "^000000";
	mes "3rd: ^4d4dff" + $ttnames$[11] + "^000000";
	mes "4th: ^4d4dff" + $ttnames$[12] + "^000000";
	mes "5th: ^4d4dff" + $ttnames$[13] + "^000000";
	close;
}

turbo_room,75,95,5	duplicate(TurboSoloNames)	Solo Mode#1	857
turbo_room,67,95,5	duplicate(TurboNormalNames)	Normal Mode Records#1	857
turbo_room,71,95,5	duplicate(TurboExpertNames)	Expert Mode Records#1	857

// Turbo Track Item Exchanger
turbo_room,93,117,5	script	Point Exchange Helper	125,{
	if ((MaxWeight-Weight) < 2000 || checkweight(1201,1) == 0) {
		mes "^3355FFWait a second!";
		mes "Right now, you're carrying";
		mes "too many items with you.";
		mes "Please come back after";
		mes "putting storing some of your";
		mes "things using the Kafra Service.^000000";
		close;
	}
	if (tt_point < 10) {
		mes "[Item Exchange Helper]";
		mes "Good day,";
		mes "" + strcharinfo(0) + ".";
		mes "You've got a total of";
		mes "" + tt_point + " Turbo Track Points.";
		next;
		mes "[Item Exchange Helper]";
		mes "If you have at least";
		mes "10 Turbo Track Points,";
		mes "you can exchange these";
		mes "points for items. Would";
		mes "you like to see the Turbo";
		mes "Track Point exchange list?";
		next;
		if (select("Yes.:Cancel.") == 1) {
			mes "[Item Exchange Helper]";
			mes "^3355FF10 TTP^000000: 1 Free Ticket";
			mes "for Kafra Transportation";
			mes "^3355FF12 TTP^000000: 1 Level 5 Magic Scroll";
			mes "^3355FF40 TTP^000000: Experience Points";
			next;
			mes "[Item Exchange Helper]";
			mes "^3355FF150 TTP^000000: 1 3 Carat Diamond";
			mes "^3355FF300 TTP^000000: 1 Gift Box";
			mes "^3355FF400 TTP^000000: 1 Speed Potion";
			next;
			mes "[Item Exchange Helper]";
			mes "You can also convert Turbo Track Points into Arena Points. For more information, please speak to the Arena Point Manager. Thank you.";
			close;
		}
		mes "[Item Exchange Helper]";
		mes "We hope that you enjoy";
		mes "Al De Baran's Turbo Track.";
		mes "Try to earn as many points";
		mes "as you can so that you can";
		mes "exchange them for useful";
		mes "stuff later. Happy racing~";
		close;
	}
	else {
		mes "[Item Exchange Helper]";
		mes "Good day,";
		mes "" + strcharinfo(0) + ".";
		mes "You've got a total of";
		mes "" + tt_point + " Turbo Track Points.";
		mes "Would you like to exchange";
		mes "these points for items?";
		next;
		switch(select("Exchange.:Cancel.")) {
		case 1:
			mes "[Item Exchange Helper]";
			mes "Please choose the item for";
			mes "which you'd like to exchange";
			mes "your Turbo Track Points.";
			next;
			switch(select("Free Ticket for Kafra Transportation:Level 5 Magic Scroll:Experience Points:3 Carat Diamond:Gift Box:Speed Potion:Cancel.")) {
			case 1:
				mes "[Item Exchange Helper]";
				mes "Each Free Ticket for";
				mes "Kafra Transportation";
				mes "costs 10 Turbo Track Points.";
				mes "Please enter the amount that";
				mes "you wish to have. To cancel,";
				mes "please enter ''^3355FF0^000000.''";
				next;
				input .@input;
				if (.@input == 0) {
					mes "[Item Exchange Helper]";
					mes "You have";
					mes "canceled";
					mes "your request.";
					close;
				}
				else if (.@input < 0 || .@input > 50) {
					mes "[Item Exchange Helper]";
					mes "Your request exceeds";
					mes "the maximum limit. You";
					mes "can only receive a maximum";
					mes "of 50 tickets at once.";
					close;
				}
				else {
					set .@total_point,10 * .@input;
					if (.@total_point > tt_point) {
						mes "[Item Exchange Helper]";
						mes "I'm sorry, but you do";
						mes "not have enough Turbo";
						mes "Track Points. Please check";
						mes "the amount of Turbo Track";
						mes "Points you have earned before";
						mes "redeeming your points again.";
						close;
					}
					set tt_point,tt_point-.@total_point;
					getitem 7060,.@input; //Warp_Free_Ticket
					mes "[Item Exchange Helper]";
					mes "Thank you for";
					mes "your patronage.";
					mes "We hope you enjoy";
					mes "your time here in";
					mes "the Turbo Track~";
					close;
				}
			case 2:
				mes "[Item Exchange Helper]";
				mes "Each Magic Scroll costs";
				mes "12 Turbo Track Points. Please";
				mes "select the Magic Scroll you would like to receive. Each scroll enables a one time use of a Level 5 spell or skill.";
				next;
				switch(select("Earth Spike:Cold Bolt:Fire Bolt:Lightning Bolt:Soul Strike:Fire Ball:Fire Wall:Frost Diver:Heal")) {
				case 1:
					set .@scroll,687; //Earth_Scroll_1_5
					set .@name$,"Earth Spike";
					break;
				case 2:
					set .@scroll,689; //Cold_Scroll_1_5
					set .@name$,"Cold Boltl";
					break;
				case 3:
					set .@scroll,691; //Fire_Scroll_1_5
					set .@name$,"Fire Bolt";
					break;
				case 4:
					set .@scroll,693; //Wind_Scroll_1_5
					set .@name$,"Lightning Bolt";
					break;
				case 5:
					set .@scroll,695; //Ghost_Scroll_1_5
					set .@name$,"Soul Strike";
					break;
				case 6:
					set .@scroll,697; //Fire_Scroll_2_5
					set .@name$,"Fire Ball";
					break;
				case 7:
					set .@scroll,699; //Fire_Scroll_3_5
					set .@name$,"Fire Wall";
					break;
				case 8:
					set .@scroll,12000; //Cold_Scroll_2_5
					set .@name$,"Frost Diver";
					break;
				case 9:
					set .@scroll,12002; //Holy_Scroll_1_5
					set .@name$,"Heal";
					break;
				}
				mes "[Item Exchange Helper]";
				mes "Please enter the number";
				mes "of ^4d4dff"+.@name$+"^000000 Magic Scrolls that";
				mes "you would like to receive.";
				mes "To cancel, enter ''^3355FF0^000000.''";
				next;
				input .@input;
				if (.@input == 0) {
					mes "[Item Exchange Helper]";
					mes "You have";
					mes "canceled";
					mes "your request.";
					close;
				}
				else if (.@input < 0 || .@input > 50) {
					mes "[Item Exchange Helper]";
					mes "I'm sorry, but your";
					mes "request has exceeded the";
					mes "maximum limit. You can only";
					mes "request up to 50 scrolls at once. ^FFFFFFcobo^000000";
					close;
				}
				else {
					set .@total_point,12 * .@input;
					if (.@total_point > tt_point) {
						mes "[Item Exchange Helper]";
						mes "I'm sorry, but you do";
						mes "not have enough Turbo";
						mes "Track Points. Please check";
						mes "the amount of Turbo Track";
						mes "Points you have earned before";
						mes "redeeming your points again.";
						close;
					}
					set tt_point,tt_point-.@total_point;
					getitem .@scroll,.@input;
					mes "[Item Exchange Helper]";
					mes "Thank you for";
					mes "your patronage.";
					mes "We hope you enjoy";
					mes "your time here in";
					mes "the Turbo Track~";
					close;
				}
			case 3:
				mes "[Item Exchange Helper]";
				mes "You can exchange";
				mes "40 Turbo Track Points";
				mes "to receive Base Level";
				mes "Experience. Would you";
				mes "like to exchange your Turbo";
				mes "Track Points for Experience?";
				next;
				if (select("No:Yes") == 2) {
					if (tt_point < 40) {
						mes "[Item Exchange Helper]";
						mes "I'm sorry, but you do";
						mes "not have enough Turbo";
						mes "Track Points. Please check";
						mes "the amount of Turbo Track";
						mes "Points you have earned before";
						mes "redeeming your points again.";
						close;
	
					}
					set tt_point,tt_point-40;
					if (BaseLevel < 70)
						getexp 300,0;
					else if (BaseLevel < 80)
						getexp 900,0;
					else if (BaseLevel < 90)
						getexp 1000,0;
					else if (BaseLevel < 151)
						getexp 3000,0;
					mes "[Item Exchange Helper]";
					mes "Thank you, your";
					mes "Turbo Track Points";
					mes "have been converted into";
					mes "Base Level Experience.";
					close;
				}
				mes "[Item Exchange Helper]";
				mes "You have";
				mes "canceled";
				mes "your request.";
				close;
			case 4:
				mes "[Item Exchange Helper]";
				mes "You can exchange";
				mes "150 Turbo Track Points";
				mes "for ^3131FF1 3 Carat Diamond^000000.";
				mes "Please enter the number of";
				mes "diamonds you would like to receive.";
				mes "To cancel, enter ''^3355FF0^000000.''";
				next;
				input .@input;
				if (.@input == 0) {
					mes "[Item Exchange Helper]";
					mes "You have";
					mes "canceled";
					mes "your request.";
					close;
				}
				else if (.@input < 0 || .@input > 10) {
					mes "[Item Exchange Helper]";
					mes "Your request exceeds";
					mes "the maximum limit. You";
					mes "can only receive a maximum";
					mes "of 10 diamonds at once.";
					close;
				}
				else {
					set .@total_point,150 * .@input;
					if (.@total_point > tt_point) {
						mes "[Item Exchange Helper]";
						mes "I'm sorry, but you do";
						mes "not have enough Turbo";
						mes "Track Points. Please check";
						mes "the amount of Turbo Track";
						mes "Points you have earned before";
						mes "redeeming your points again.";
						close;
					}
					set tt_point,tt_point-.@total_point;
					getitem 732,.@input; //Crystal_Jewel__
					mes "[Item Exchange Helper]";
					mes "Thank you for";
					mes "your patronage.";
					mes "We hope you enjoy";
					mes "your time here in";
					mes "the Turbo Track~";
					close;
				}
			case 5:
				mes "[Item Exchange Helper]";
				mes "You can exchange";
				mes "300 Turbo Track Points";
				mes "for ^3131FF1 Gift Box^000000. Please enter";
				mes "the number of Gift Boxes";
				mes "that you'd like to receive.";
				mes "To cancel, enter ''^3355FF0^000000.''";
				next;
				input .@input;
				if (.@input == 0) {
					mes "[Item Exchange Helper]";
					mes "You have";
					mes "canceled";
					mes "your request.";
					close;
				}
				else if (.@input < 0 || .@input > 10) {
					mes "[Item Exchange Helper]";
					mes "Your request exceeds";
					mes "the maximum limit. You";
					mes "can only receive a maximum";
					mes "of 10 Gift Boxes at once.";
					close;
				}
				else {
					set .@total_point,300 * .@input;
					if (.@total_point > tt_point) {
						mes "[Item Exchange Helper]";
						mes "I'm sorry, but you do";
						mes "not have enough Turbo";
						mes "Track Points. Please check";
						mes "the amount of Turbo Track";
						mes "Points you have earned before";
						mes "redeeming your points again.";
						close;
					}
					set tt_point,tt_point-.@total_point;
					getitem 644,.@input; //Gift_Box
					mes "[Item Exchange Helper]";
					mes "Thank you for";
					mes "your patronage.";
					mes "We hope you enjoy";
					mes "your time here in";
					mes "the Turbo Track~";
					close;
				}
			case 6:
				mes "[Item Exchange Helper]";
				mes "You can exchange";
				mes "400 Turbo Track Points";
				mes "for ^3131FF1 Speed Potion^000000. Please";
				mes "enter the number of potions";
				mes "that you'd like to receive.";
				mes "To cancel, enter ''^3355FF0^000000.''";
				next;
				input .@input;
				if (.@input == 0) {
					mes "[Item Exchange Helper]";
					mes "You have";
					mes "canceled";
					mes "your request.";
					close;
				}
				else if (.@input < 0 || .@input > 10) {
					mes "[Item Exchange Helper]";
					mes "Your request exceeds";
					mes "the maximum limit. You";
					mes "can only receive a maximum";
					mes "of 10 potions at once.";
					close;
				}
				else {
					set .@total_point,400 * .@input;
					if (.@total_point > tt_point) {
						mes "[Item Exchange Helper]";
						mes "I'm sorry, but you do";
						mes "not have enough Turbo";
						mes "Track Points. Please check";
						mes "the amount of Turbo Track";
						mes "Points you have earned before";
						mes "redeeming your points again.";
						close;
					}
					set tt_point,tt_point-.@total_point;
					getitem 12016,.@input; //Speed_Up_Potion
					mes "[Item Exchange Helper]";
					mes "Thank you for";
					mes "your patronage.";
					mes "We hope you enjoy";
					mes "your time here in";
					mes "the Turbo Track~";
					close;
				}
			case 7:
				mes "[Item Exchange Helper]";
				mes "This Item Exchange";
				mes "Service is brought";
				mes "to you by...";
				next;
				mes "[Item Exchange Helper]";
				mes "This Item Exchange Service";
				mes "is brought to you by the Kafra";
				mes "Corporation, Blacksmith Guild";
				mes "and the Comodo Casino and";
				mes "the Al De Baran Guild Castle";
				mes "Management Luina.";
				close;
			}
		case 2:
			mes "[Item Exchange Helper]";
			mes "Turbo Track Points can be";
			mes "converted into Arena Points.";
			mes "You can save a maximum of";
			mes "^4D4DFF29,000 Turbo Track Points.";
			next;
			mes "[Item Exchange Helper]";
			mes "Before reaching the maximum";
			mes "amount of Turbo Track Points,";
			mes "you might want to spend some";
			mes "of them so that you can keep";
			mes "getting your point rewards after winning Turbo Track races.";
			close;
		}
	}
}

turbo_room,106,117,3	script	Point Manager#tt	833,{
	mes "[Turbo Track Point Manager]";
	mes "Good day.";
	mes "Did you enjoy your";
	mes "time in Turbo Track?";
	mes "How may I be of";
	mes "assistance?";
	next;
	switch(select("Check Points:Convert Points:^660000Conversion Info^000000")) {
	case 1:
		mes "[Turbo Track Point Manager]";
		mes "" + strcharinfo(0) + ",";
		mes "you currently have";
		mes "" + tt_point + " Turbo Track Points";
		mes "and " + arena_point + " Arena Points.";
		close;
	case 2:
		mes "[Turbo Track Point Manager]";
		mes "" + strcharinfo(0) + ",";
		mes "you currently have";
		mes "" + tt_point + " Turbo Track Points";
		mes "and " + arena_point + " Arena Points.";
		next;
		mes "[Turbo Track Point Manager]";
		mes "Please choose from among the following Arena Point conversions. When converting more than";
		mes "10 Arena Points at once, you";
		mes "can only convert Arena Points";
		mes "in ^4D4DFFmultiples of 10^000000.";
		next;
		switch(select("2 AP -> 1 TTP:4 AP -> 2 TTP:6 AP -> 3 TTP:8 AP -> 4 TTP:10 AP or more:Cancel")) {
		case 1:
			callsub S_ExchangePoints,28999,2,1;
		case 2:
			callsub S_ExchangePoints,28998,4,2;
		case 3:
			callsub S_ExchangePoints,28997,6,2;
		case 4:
			callsub S_ExchangePoints,28996,8,4;
		case 5:
			mes "[Turbo Track Point Manager]";
			mes "Please enter the number of times you wish to convert 10 Arena Points into Turbo Track Points. The largest value you may enter";
			mes "is 20. To cancel, enter '^3355FF0^000000.'";
			next;
			input .@input;
			if (.@input == 0) {
				mes "[Turbo Track Point Manager]";
				mes "You have";
				mes "canceled";
				mes "your request.";
				close;
			}
			else if (.@input > 20) {
				mes "[Turbo Track Point Manager]";
				mes "Your request exceeds";
				mes "the maximum limit. Please";
				mes "enter a value no greater than 20.";
				close;
			}
			else {
				set .@want_point1,10 * .@input;
				set .@want_point,5 * .@input;
				set .@my_turbo_all,tt_point+.@want_point;
				set .@my_arena_all,arena_point-.@want_point1;
				if (.@my_turbo_all > 28999) {
					mes "[Turbo Track Point Manager]";
					mes "Unfortunately, your Turbo Track Points will exceed the maximum limit if we proceed with point conversion. Please spend more";
					mes "of your Turbo Track Points before using this service. Thank you.";
					close;
				}
				if (.@my_arena_all < 0) {
					mes "[Turbo Track Point Manager]";
					mes "I am sorry, but you do";
					mes "not have enough Arena Points";
					mes "to perform this Turbo Track";
					mes "Point conversion.";
					close;
				}
				else {
					mes "[Turbo Track Point Manager]";
					mes "You have converted";
					mes "10 Arena Points into";
					mes "Turbo Track Points " + .@input + " times.";
					mes "A total of " + .@want_point1 + " Arena Points";
					mes "has been converted into";
					mes "" + .@want_point +" Turbo Track Points.";
					set arena_point,.@my_arena_all; //arena_point
					set tt_point,.@my_turbo_all;
					next;
					mes "[Turbo Track Point Manager]";
					mes "" + strcharinfo(0) + ",";
					mes "you now have";
					mes "^00688B" + tt_point + "^000000 Turbo Track Points";
					mes "and ^4682B4" + arena_point + "^000000 Arena Points.";
					mes "Thank you for your patronage.";
					close;
				}
			}
		case 6:
			mes "[Turbo Track Point Manager]";
			mes "You have";
			mes "canceled";
			mes "your request.";
			close;
		}
	case 3:
		// There is no dialog for this option.
		// It's possible it's missing, or maybe
		// the dialog was never translated. XD
		close;
	}

S_ExchangePoints:
	if (tt_point > getarg(0)) {
		mes "[Turbo Track Point Manager]";
		mes "Unfortunately, your Turbo Track Points will exceed the maximum limit if we proceed with point conversion. Please spend more";
		mes "of your Turbo Track Points before using this service. Thank you.";
		close;
	}
	if (arena_point >= getarg(1)) {
		mes "[Turbo Track Point Manager]";
		mes "As requested,";
		mes "2 Arena Points";
		mes "have been converted";
		mes "into 1 Turbo Track Point.";
		set arena_point,arena_point-getarg(1);
		set tt_point,tt_point+getarg(2);
		next;
		mes "[Turbo Track Point Manager]";
		mes "" + strcharinfo(0) + ",";
		mes "you now have";
		mes "^00688B" + tt_point + "^000000 Turbo Track Points";
		mes "and ^4682B4" + arena_point + "^000000 Arena Points.";
		mes "Thank you for your patronage.";
		close;
	}
	else {
		mes "[Turbo Track Point Manager]";
		mes "I'm sorry, but you do not have enough Arena Points. You need";
		mes "at least 2 Arena Points in order";
		mes "to use this service.";
		close;
	}
}

alde_gld,183,204,0	script	en_turbo	45,1,1,{
OnTouch:
	if (checkweight(1201,1) == 0) {
		mes "^3355FFWait a second!";
		mes "Right now, you're carrying";
		mes "too many items with you.";
		mes "Please come back after";
		mes "putting storing some of your";
		mes "things using the Kafra Service.^000000";
		close;
	}
	set .@now_weight,MaxWeight-Weight;
	if ((BaseJob == Job_Knight || BaseJob == Job_Crusader) && checkriding()) {
		if (.@now_weight < 20000) {
			mes "[Helper]";
			mes "Peco Pecos are prohibited";
			mes "in the Turbo Track Arena.";
			mes "Please dismount from your";
			mes "Peco Peco and you will receive";
			mes "a Free Ticket for Peco Ride";
			mes "for retrieving your Peco Peco.";
			close2;
			warp "alde_gld",183,199;
			end;
		}
		else {
			setriding 0;
			getitem 7310,1; //Free_Peco_Ticket
			warp "turbo_room",100,65;
		}
	}
	else
		warp "turbo_room",100,65;
	end;
}

alde_gld,186,199,3	script	Turbo Track Guide#Entran	845,{
	mes "[Guide]";
	mes "Welcome to";
	mes "the Al De Baran";
	mes "Turbo Track~";
	next;
	mes "[Guide]";
	mes "Peco Pecos are prohibited inside the Turbo Track Arena. But anyone riding on a Peco Peco will receive a Free Peco Peco Mount Ticket at the Turbo Track Entrance and automatically dismount.";
	next;
	mes "[Guide]";
	mes "Well then,";
	mes "enjoy your time";
	mes "in Turbo Track~!";
	close;
}

alde_gld,181,199,5	script	Peco Peco Manager	845,{
	mes "[Peco Peco Manager]";
	if (BaseJob == Job_Knight || BaseJob == Job_Crusader) {
		mes "Welcome, would you like";
		mes "to retrieve your Peco Peco?";
		mes "Please show me your Free";
		mes "Ticket for Peco Ride. You";
		mes "may also pay a rental fee";
		mes "of 2,500 zeny.";
		next;
		switch(select("Use:Cancel")) {
		case 1:
			if (getskilllv(63) == 0) {
				mes "[Peco Peco Manager]";
				mes "I'm sorry, but you're";
				mes "not eligible for this";
				mes "service. Please go learn";
				mes "the Peco Peco Ride skill first.";
				close;
			}
			else {
				if (checkriding()) {
					mes "[Peco Peco Manager]";
					mes "You're already";
					mes "mounted on a";
					mes "Peco Peco.";
					mes "Thank you~";
					close;
				}
				else {
					if (countitem(7310) < 1 && Zeny < 2500) {
						mes "[Peco Peco Manager]";
						mes "I'm sorry, but you";
						mes "don't have a Free Ticket";
						mes "for Peco Ride or 2,500 zeny.";
						mes "to use the Peco rental service.";
						close;
					}
					else {
						if (countitem(7310) > 0)
							delitem 7310,1; //Free_Peco_Ticket
						else
							set zeny,zeny-2500;
						setriding;
						mes "[Peco Peco Manager]";
						mes "Thank you for";
						mes "your patronage~";
						close;
					}
				}
			}
		case 2:
			mes "[Peco Peco Manager]";
			mes "Are you going";
			mes "back to race in";
			mes "the Turbo Track?";
			mes "Good luck!";
			close;
		}
	}
	else {
		mes "Thank you for";
		mes "visiting Al De Baran's";
		mes "Turbo Track~";
		close;
	}
}

alde_gld,178,180,0	script	Sign#TBT	837,{
	mes "[Al De Baran Turbo Track]";
	mes "This way...";
	mes "to the Al De Baran";
	mes "Turbo Track Arena!";
	next;
	mes "[Al De Baran Turbo Track]";
	mes "Turbo Track is";
	mes "an arena where";
	mes "participants compete to be the first to reach the Finish Line! Don't miss the chance to race against your friends!";
	close;
}
