
//@unloadnpc Stylist#pay
//@loadnpc npc/valhalla/stylist.txt

office,136,31,2	script	Stylist#pay	4_F_MAYSEL,{
	//cutin "lunain01",2;	
	mes "[ ^ff0000Stylist^000000 ]";
	mes "Hello "+strcharinfo(PC_NAME);
	mes "I'm your stylist, you can change hairstyle, dye clothing and hair and also make costume out of regular headgear.  What would you like to do?";
	while(1) {
		next;
		switch(select(
		"^777777Open Stylist^000000:"+
		"^777777Make Costume^000000:"+
		"^777777Restore Costume^000000:"+
		"^ff0000Close^000000"
		)) {
		case 1: 
			setarray .@styles[1],getbattleflag("max_cloth_color"),getbattleflag("max_hair_style"),getbattleflag("max_hair_color");
			setarray .@Look[1],7,1,6;
			set .@s, select(" ~ Cloth color", " ~ Hairstyle", " ~ Hair color");
			set .@Revert, getlook(.@Look[.@s]);
			set .@style,1;
			while(1) {
				setlook .@Look[.@s], .@style;
				message strcharinfo(PC_NAME),"This is style #"+.@style+".";
				set .@menu$, " ~ Next (^0055FF"+((.@style!=.@styles[.@s])?.@style+1:1)+"^000000): ~ Previous (^0055FF"+((.@style!=1)?.@style-1:.@styles[.@s])+"^000000): ~ Jump to...: ~ Revert to original (^0055FF"+.@Revert+"^000000)";
				switch(select(.@menu$)) {
					case 1: set .@style, ((.@style!=.@styles[.@s])?.@style+1:1); break;
					case 2: set .@style, ((.@style!=1)?.@style-1:.@styles[.@s]); break;
					case 3: message strcharinfo(PC_NAME),"Choose a style between 1 - "+.@styles[.@s]+".";
						input .@style,0,.@styles[.@s];
						if (!.@style) set .@style, rand(1,.@styles[.@s]);
						break;
					case 4: set .@style, .@Revert; setlook .@Look[.@s], .@Revert; break;
				}
			}
			break;

		case 2:
			mes "[ ^ff0000Stylist^000000 ]";
			mes "Please, select what to convert.";
			mes "Remember, I can't process rental headgears or with cards and refine.";
			next;
			.@check = getequipisequiped(EQI_HEAD_TOP)+getequipisequiped(EQI_HEAD_MID)+getequipisequiped(EQI_HEAD_LOW);
			if (!.@check) {
				mes "[ ^ff0000Stylist^000000 ]";
				//cutin "lunain02",2;
				mes "Haha, you are not wearing any regular headgear.";
				break;
			}
			
			setarray .@Position$[1],"Top","Mid","Low";
			setarray .@Position[1],     1,    9,   10;
			set .@Menu$,"";
	
			for( set .@i, 1; .@i < 5; set .@i, .@i + 1 )
			{
				if( getequipisequiped(.@Position[.@i]) )
				set .@Menu$, .@Menu$ + .@Position$[.@i] + "-" + "[^ff0000" + getequipname(.@Position[.@i]) + "^000000]";
				set .@Menu$, .@Menu$ + ":";
			}
			set .@Part, .@Position[ select(.@Menu$) ];
			set .@id, getequipid(.@Part);
			set .@ref, getequiprefinerycnt(.@Part);
			if( !getequipisequiped(.@Part) )
			{
				//cutin "lunain02",2;
				mes "[ ^ff0000Stylist^000000 ]";
				mes "Your not wearing anything there...";
				break;
			}
			mes "[ ^ff0000Stylist^000000 ]";
			mes "You want to Costume your ^ff0000" + getitemname(getequipid(.@Part)) + "^000000?";
			next;
			if( select("Yes, proceed:No, I am sorry.") == 2 )
			{	
				//cutin "lunain03",2;
				mes "[ ^ff0000Stylist^000000 ]";
				mes "Need some time to think about it, huh? Alright, I can understand.";
				break;
			}
			for(set .@i,0; .@i<4; set .@i,.@i+1)
				set .@slot[.@i], getequipcardid(.@Part,.@i);
			if (.@slot[0]>4000 && .@slot[0]<5000) { // If it has card don't convert
				//cutin "lunain02",2;
				mes "[ ^ff0000Stylist^000000 ]";
				mes "A card? Here?!";
				mes "As I said before, I don't convert headgear with cards.";
				emotion e_hmm;
				break;
			}
			getinventorylist;
			for(set .@i,0; .@i<@inventorylist_count; set .@i,.@i+1)
				if (@inventorylist_expire[.@i] != 0 && @inventorylist_equip[.@i] != 0) { // If rental don't convert
				//cutin "lunain02",2;
				mes "[ ^ff0000Stylist^000000 ]";
				mes "Sorry, I don't convert a rental headgear!";
				emotion e_hmm;
				break;
				}
				if (.@ref > 0) { // If refine don't convert
				//cutin "lunain02",2;
				mes "[ ^ff0000Stylist^000000 ]";
				mes "Sorry please keep in mind.";
				mes "I don't convert headgear with refine.";
				emotion e_hmm;
				break;
				}
			if (!countitem(.@id)) { 
				//cutin "lunain02",2;
				mes "[ ^ff0000Stylist^000000 ]";
				mes "Where is ^ff0000"+getitemname(@id)+"^000000...?";
				npctalk "You're a snoozy cheater!";
				logmes "CHEATER: Tried to sign an item not having it: "+getitemname(@id);
				emotion e_wah;
				break;
			}
			costume .@Part; // Convert the Headgear
			//cutin "lunain03",2;	
			mes "[ ^ff0000Stylist^000000 ]";
			mes "Done, enjoy your costume headgear.";
			break;
		case 3:
			mes "[ ^ff0000Stylist^000000 ]";
			mes "Please, select what to restore.";
			mes "Remember, I will only restore it back without refine and cards.";
			next;
			.@check = getequipisequiped(EQI_COSTUME_HEAD_TOP)+getequipisequiped(EQI_COSTUME_HEAD_MID)+getequipisequiped(EQI_COSTUME_HEAD_LOW);
			if (!.@check) {
				mes "[ ^ff0000Stylist^000000 ]";
				//cutin "lunain02",2;
				mes "Haha, you are not wearing any costume headgear.";
				break;
			}

			setarray .@Position$[1],"Top","Mid","Low";
			setarray .@Position[1],     13,    12,   11;
			set .@Menu$,"";
			for( set .@i, 1; .@i < 5; set .@i, .@i + 1 )
			{
				if( getequipisequiped(.@Position[.@i]) )
				set .@Menu$, .@Menu$ + .@Position$[.@i] + "-" + "[^ff0000" + getequipname(.@Position[.@i]) + "^000000]";
				set .@Menu$, .@Menu$ + ":";
			}
			set .@Part, .@Position[ select(.@Menu$) ];
			if( !getequipisequiped(.@Part) )
			{
				//cutin "lunain02",2;
				mes "[ ^ff0000Stylist^000000 ]";
				mes "Your not wearing anything there...";
				break;
			}
			mes "[ ^ff0000Stylist^000000 ]";
			mes "You want to restore your ^ff0000" + getitemname(getequipid(.@Part)) + "^000000?";
			next;
			if( select("Yes, proceed:No, I am sorry.") == 2 )
			{
				//cutin "lunain02",2;
				mes "[ ^ff0000Stylist^000000 ]";
				mes "Need some time to think about it, huh?";
				mes "Alright, I can understand.";
				break;
			}
			uncostume .@Part;
			//cutin "lunain03",2;
			mes "[ ^ff0000Stylist^000000 ]";
			mes "Done, enjoy your restored headgear.";
			break;
		default:
			close2;
			//cutin "",255;
			end;
		}
		close2;
		//cutin "",255;
		end;
	}
}

