//@unloadnpc Channel Assistant
//@loadnpc npc/amatsu/channels.txt

office,128,23,0	script	Channel Assistant	8W_SOLDIER,{
	
	OnSettings:
		if(questprogress(31001) == 1 && countitem(30105) > 0 ) {
			cutin "prt_soldier",2;
			mes .npc$;
			mes "Good day ^003366"+strcharinfo(PC_NAME)+"^000000! I'm the Channel Assistant.";
			next;
			mes .npc$;
			mes "Sometimes it is very annoying to see so much information is displayed in your screen. I'm here to assist you with that. You can turn ^28bf00on^000000/^ff0000off^000000 any message channel anytime.";
			nov_train1++;
			switch (BaseLevel){
			case 1: getexp 9,0; break;
			case 2: getexp 16,0; break;
			case 3: getexp 25,0; break;
			case 4: getexp 36,0; break;
			case 5: getexp 77,0; break;
			case 6: getexp 112,0; break;
			case 7: getexp 153,0; break;
			case 8: getexp 200,0; break;
			case 9: getexp 253,0; break;
			case 10: getexp 320,0; break;
			case 11: getexp 385,0; break;
			case 12: getexp 490,0; break;
			case 13: getexp 585,0; break;
			case 14: getexp 700,0; break;
			case 15: getexp 830,0; break;
			case 16: getexp 970,0; break;
			case 17: getexp 1120,0; break;
			case 18: getexp 1260,0; break;
			case 19: getexp 1420,0; break;
			}	
			delitem 30105,countitem(30105);
			if(nov_train1 == 6){
				next;
				mes .npc$;
				mes "Go back and talk to ^ff0000Percy^000000 now, I bet she will be happy that you learned so many NPC at this room already.";
				completequest(31001);
				setquest(31002);
				cutin "",255;
				close;
			}
			cutin "",255;	
			close;			
		}
		cutin "prt_soldier",2;		
		mes .npc$;
		mes " Hello ^00CC00"+strcharinfo(PC_NAME)+"^000000!";
		mes "Sometimes it is very annoying to see so much information is displayed in your screen. I'm here to assist you with that.  Please select the announce information you wish to see.";
		while(1) {

			switch(select(
			 ((!#channel_system)?"- #system is [ ^ff0000Off^000000 ]:":"- #system is [ ^28bf00On^000000 ]:")+
			 ((!#channel_buying)?"- #buying is [ ^ff0000Off^000000 ]:":"- #buying is [ ^28bf00On^000000 ]:")+
			 ((!#channel_selling)?"- #selling is [ ^ff0000Off^000000 ]:":"- #selling is [ ^28bf00On^000000 ]:")+
			 ((!#channel_recruit)?"- #recruit is [ ^ff0000Off^000000 ]:":"- #recruit is [ ^28bf00On^000000 ]:")+
			 ((!#channel_battle)?"- #battle is [ ^ff0000Off^000000 ]:":"- #battle is [ ^28bf00On^000000 ]:")+
			 ((!#channel_event)?"- #event is [ ^ff0000Off^000000 ]:":"- #event is [ ^28bf00On^000000 ]:")+
	 		 "- ^777777Close^000000"
			)) {

		case 1:
			if (!#channel_system) { set #channel_system,1; atcommand "@join #system"; } else { set #channel_system,0; atcommand "@channel leave #system";} 
			break;
		case 2:
			if (!#channel_buying) { set #channel_buying,1; atcommand "@join #buying"; } else { set #channel_buying,0; atcommand "@channel leave #buying";}
			break;
		case 3:
			if (!#channel_selling) { set #channel_selling,1; atcommand "@join #selling"; } else { set #channel_selling,0; atcommand "@channel leave #selling";}
			break;
		case 4:
			if (!#channel_recruit) { set #channel_recruit,1; atcommand "@join #recruit"; } else { set #channel_recruit,0; atcommand "@channel leave #recruit";}
			break;
		case 5:
			if (!#channel_battle) { set #channel_battle,1; atcommand "@join #battle"; } else { set #channel_battle,0; atcommand "@channel leave #battle";}
			break;
		case 6:
			if (!#channel_event) { set #channel_event,1; atcommand "@join #event"; } else { set #channel_event,0; atcommand "@channel leave #event";}
			break;

		default:
			cutin "",255;
			close;
		}
	}	

	OnPCLoginEvent:
		if (!#channe2) {
			#channel_system = 1;
			#channel_buying = 1;
			#channel_selling = 1;
			#channel_recruit = 1;
			#channel_battle = 1;
			#channel_event = 1;
			#channel = 0;
			#channel2 = 1;


		}
		//localchannel
		if(#channel_system) { atcommand "@join #system";}
		if(#channel_buying) { atcommand "@join #buying";}
		if(#channel_selling) { atcommand "@join #selling";}
		if(#channel_recruit) { atcommand "@join #recruit";}
		if(#channel_battle) { atcommand "@join #battle";}
		if(#channel_event) { atcommand "@join #event";}
		end;

OnInit:
	questinfo(QTYPE_JOB, 1);
	setquestinfo(QINFO_JOB, Job_Novice);
	setquestinfo(QINFO_QUEST, 31001, 1);
	setquestinfo(QINFO_ITEM, 30105, 1,1);
	set .npc$,"[ ^ff0000Channel Assistant^000000 ]";
	end;

}
