//================= Hercules Script =======================================
//=       _   _                     _
//=      | | | |                   | |
//=      | |_| | ___ _ __ ___ _   _| | ___  ___
//=      |  _  |/ _ \ '__/ __| | | | |/ _ \/ __|
//=      | | | |  __/ | | (__| |_| | |  __/\__ \
//=      \_| |_/\___|_|  \___|\__,_|_|\___||___/
//================= License ===============================================
//= This file is part of Hercules.
//= http://herc.ws - http://github.com/HerculesWS/Hercules
//=
//= Copyright (C) 2013-2015  Hercules Dev Team
//= Copyright (C)  Kisuka
//= Copyright (C)  Euphy
//=
//= Hercules is free software: you can redistribute it and/or modify
//= it under the terms of the GNU General Public License as published by
//= the Free Software Foundation, either version 3 of the License, or
//= (at your option) any later version.
//=
//= This program is distributed in the hope that it will be useful,
//= but WITHOUT ANY WARRANTY; without even the implied warranty of
//= MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//= GNU General Public License for more details.
//=
//= You should have received a copy of the GNU General Public License
//= along with this program.  If not, see <http://www.gnu.org/licenses/>.
//=========================================================================
//= Job Repairs
//================= Description ===========================================
//= Removes potentially conflicting job data.
//================= Current Version =======================================
//= 1.2
//=========================================================================

prt_in,38,104,4	script	Valerie	4_F_VALKYRIE,{
	if (checkweight(Knife,1) == 0) {
		mes "I think you have too many items. Let's try it again after you take some out.";
		close;
	}
	if (MaxWeight - Weight < 1000) {
		mes "You're overweight with items so I don't think we can proceed any further. Challenge me after you've taken some items off.";
		close;
	}
	mes "[Valerie]";
	mes "I am Valerie; I help those with abnormalities. I am friends with Valkyrie.";
	next;
	mes "[Valerie]";
	mes "If both abnormalities disappear then we must start the test over from scratch. What would you like to do?";
	next;
	switch(select("I don't have any abnormalities", "I think my body has some abnormalities")) {
	case 1:
		mes "[Valerie]";
		mes "That's a relief. Then please take care.";
		close;
	case 2:
		mes "[Valerie]";
		mes "Are you sure you want to intialize it and start over?";
		next;
		if(select("Nope", "Yes, I want to start completely over") == 1) {
			mes "[Valerie]";
			mes "I understand. I'll see you next time";
			close;
		}
		mes "[Valerie]";
		mes "All items related to the existing conditions will disappear. Are you okay with this?";
		next;
		if(select("Nope", "Yes, I want to start completely over.") == 1) {
			mes "[Valerie]";
			mes "I understand. I'll see you next time.";
			close;
		}
		mes "[Valerie]";
		mes "It seems that there are a sea of people who seemed to be cursed of not being able to get a significant other after going through with this. Are you still okay with this? ";
		next;
		if(select("Nope", "I still want to intialize.") == 1) {
			mes "[Valerie]";
			mes "I understand. I will see you next time.";
			close;
		}
		mes "[Valerie]";
		mes "In extreme cases, some become crippled and can get ulcers. Do you still want to intilize former processes?";
		next;
		if(select("Nope", "Please intilize the former processes") == 1) {
			mes "[Valerie]";
			mes "I understand. I will see you next time";
			close;
		}
		specialeffect(EF_INVENOM, AREA, playerattached());
		progressbar "0xffff00",3;

		// Warlock - quest items
		if (isequipped(2796) || isequipped(2797)) {
			mes "[Valerie]";
			mes "Please unequip the Magical Stone or Magical Stone Ring and try again.";
			close;
		}
		if (countitem(Magical_Stone) || countitem(Magical_Stone_)) {
			if (isequipped(2796) || isequipped(2797)) {
				mes "[Valerie]";
				mes "Please talk to me after your replace all Magical Stones.";
				close;
			}
			setarray .@items[0], 2796, 2797, 6152, 6151; //Magical_Stone,Magical_Stone_,Glittering_Crystal,Peice_Of_Great_Bradium
			for(.@i = 0; .@i<4; ++.@i) {
				if (countitem(.@items[.@i]))
					delitem .@items[.@i], countitem(.@items[.@i]);
			}
			mes "[Valerie]";
			mes "You're carrying something that is unnecessary. I will sort it out for you.";
			close;
		}

		// Baby and third job characters meet no further conditions.
		if (eaclass()&(EAJL_BABY|EAJL_THIRD)) {
			mes "[Valerie]";
			mes "I don't think you should have any further business with me.";
			close;
		}

		// Rebirth - variable
		if ((Class >= Job_Swordman && Class <= Job_Crusader2) && ADVJOB != 0) {
			ADVJOB = 0;
			mes "[Valerie]";
			mes "You're carrying big karma- You should erase it.";
			next;
			mes "[Valerie]";
			mes "Please talk to me again as there could be additional problems.";
			close;
		}

		// Second job - variable and quests
		// callsub L_Second, "<variable>", <quest>;
		if (Class == Job_Swordman) {
			callsub L_Second, "KNIGHT_Q", 9012;
			callsub L_Second, "CRUS_Q", 3015;
		} else if (Class == Job_Archer) {
			callsub L_Second, "HNTR_Q", 4013;
			callsub L_Second, "BARD_Q", 3004;
			callsub L_Second, "DANC_Q", 7006;
		} else if (Class == Job_Mage) {
			callsub L_Second, "WIZ_Q", 9018;
			callsub L_Second, "SAGE_Q", 2052;
		} else if (Class == Job_Merchant) {
			callsub L_Second, "BSMITH_Q", 2016;
			callsub L_Second, "ALCH_Q", 2040;
		} else if (Class == Job_Thief) {
			callsub L_Second, "ASSIN_Q", 8008;
			callsub L_Second, "ROGUE_Q", 2027;
		} else if (Class == Job_Acolyte) {
			callsub L_Second, "PRIEST_Q", 8016;
			callsub L_Second, "MONK_Q", 3032;
		}

		// Third job - variable and quests
		// callsub L_Third, "<variable>", <main quest>, <first quest>, <last quest>{, <additional quest>};
		if (BaseJob == Job_Assassin)
			callsub L_Third, "job_3rd_gc", 7100, 7091, 7116;
		else if (BaseJob == Job_Blacksmith)
			callsub L_Third, "job__mechanic", 10101, 10090, 10101;
		else if (BaseJob == Job_Hunter)
			callsub L_Third, "job_ranger01", 8262, 8254, 8262;
		else if (BaseJob == Job_Knight)
			callsub L_Third, "job_rune_edq", 3219, 3200, 3220;
		else if (BaseJob == Job_Priest)
			callsub L_Third, "job_arch", 2191, 2187, 2191;
		else if (BaseJob == Job_Wizard)
			callsub L_Third, "job_wl", 11112, 11106, 11112;
		else if (BaseJob == Job_Alchemist)
			callsub L_Third, "job_gen", 2223, 2209, 2217, 2223;
		else if (BaseJob == Job_Bard)
			callsub L_Third, "job_min", 11154, 11135, 11154;
		else if (BaseJob == Job_Crusader)
			callsub L_Third, "job_royal", 0, 12090, 12094;
		else if (BaseJob == Job_Dancer)
			callsub L_Third, "job_wan", 2222, 2218, 2222;
		else if (BaseJob == Job_Monk)
			callsub L_Third, "job_shu", 11158, 11155, 11158;
		else if (BaseJob == Job_Rogue)
			callsub L_Third, "job_sha", 7180, 7160, 7180;
		else if (BaseJob == Job_Sage)
			callsub L_Third, "job_soc", 12098, 12096, 12098;

		mes "[Valerie]";
		mes "I don't think you should have any further business with me.";
		close;
	}

L_Second:
	if (getd(getarg(0)) != 0) {
		setd getarg(0),0;
		if (questprogress(getarg(1)) == 2)
			erasequest getarg(1);
		mes "[Valerie]";
		mes "I will help clear your problems for you that came from your former attempts.";
		next;
		mes "[Valerie]";
		mes "Please talk to me again as there could be additional problems.";
		close;
	} else
		return;

L_Third:
	if (getd(getarg(0)) != 0) {
		setd getarg(0),0;
		if (getarg(1)) {
			if (questprogress(getarg(1)) == 2)
				erasequest getarg(1);
		}
		for(.@i = getarg(2); .@i<=getarg(3); ++.@i) {
			if (questprogress(.@i))
				erasequest .@i;
		}
		if (getarg(4,0)) {
			if (questprogress(getarg(4)))
				erasequest getarg(4);
		}
		mes "[Valerie]";
		mes "I will help clear your problems for you that came from your former attempts.";
		next;
		mes "[Valerie]";
		mes "Please talk to me again as there could be additional problems.";
		close;
	} else
		return;
}

-	script	Valerie#sign	FAKE_NPC,{
	mes "^ff00ffI couldn't pay the office rent so I am temporarily relocating to the building across from the Prontera Refinery.^000000";
	mes " ";
	mes "^ff00ffValerie^000000";
	close;
}
in_moc_16,17,33,4	duplicate(Valerie#sign)	Valerie#asn	2_BULLETIN_BOARD
ein_in01,13,28,4	duplicate(Valerie#sign)	Valerie#bls	2_BULLETIN_BOARD
hu_in01,386,377,4	duplicate(Valerie#sign)	Valerie#hnt	2_BULLETIN_BOARD
prt_in,88,108,4	duplicate(Valerie#sign)	Valerie#knt	2_BULLETIN_BOARD
prt_church,19,36,4	duplicate(Valerie#sign)	Valerie#prst	2_BULLETIN_BOARD
gef_tower,110,30,4	duplicate(Valerie#sign)	Valerie#wiz	2_BULLETIN_BOARD
comodo,215,155,4	duplicate(Valerie#sign)	Valerie#danc	2_BULLETIN_BOARD
prt_castle,45,167,4	duplicate(Valerie#sign)	Valerie#cru	2_BULLETIN_BOARD
prt_monk,59,253,4	duplicate(Valerie#sign)	Valerie#mnk	2_BULLETIN_BOARD
moc_ruins,90,104,4	duplicate(Valerie#sign)	Valerie#rg	2_BULLETIN_BOARD
yuno_in02,43,62,4	duplicate(Valerie#sign)	Valerie#sag	2_BULLETIN_BOARD
prt_church,103,86,4	duplicate(Valerie#sign)	Valerie#arch	2_BULLETIN_BOARD
que_job01,75,92,4	duplicate(Valerie#sign)	Valerie#gc	2_BULLETIN_BOARD
yuno,129,150,4	duplicate(Valerie#sign)	Valerie#mech	2_BULLETIN_BOARD
tur_dun01,159,40,4	duplicate(Valerie#sign)	Valerie#ran	2_BULLETIN_BOARD
prt_in,167,24,4	duplicate(Valerie#sign)	Valerie#rk	2_BULLETIN_BOARD
spl_in02,81,102,4	duplicate(Valerie#sign)	Valerie#wl	2_BULLETIN_BOARD
alde_alche,38,181,4	duplicate(Valerie#sign)	Valerie#alche	2_BULLETIN_BOARD
alberta,198,129,4	duplicate(Valerie#sign)	Valerie#min	2_BULLETIN_BOARD
in_rogue,376,104,4	duplicate(Valerie#sign)	Valerie#sc	2_BULLETIN_BOARD
ve_in,244,122,4	duplicate(Valerie#sign)	Valerie#shu	2_BULLETIN_BOARD
xmas,166,209,4	duplicate(Valerie#sign)	Valerie#wan	2_BULLETIN_BOARD

sec_in02,12,40,5	script	Job Repair	1_M_LIBRARYMASTER,1,1,{
	callfunc "F_GM_NPC";
	mes "Please input your password.";
	next;
	if (callfunc("F_GM_NPC","1854",1) == 1) {
		job_arch = 100;
		job_3rd_gc = 100;
		job__mechanic = 100;
		job_ranger01 = 100;
		job_rune_edq = 100;
		job_wl = 100;
		job_gen = 100;
		job_min = 100;
		job_royal = 100;
		job_sha = 100;
		job_soc = 100;
		job_shu = 100;
		job_wan = 100;
		KNIGHT_Q = 100;
		PRIEST_Q = 100;
		WIZ_Q = 100;
		BSMITH_Q = 100;
		ASSIN_Q = 100;
		HNTR_Q = 100;
		CRUS_Q = 100;
		MONK_Q = 100;
		SAGE_Q = 100;
		ALCH_Q = 100;
		ROGUE_Q = 100;
		BARD_Q = 100;
		DANC_Q = 100;
		ADVJOB = 15;
	}
	close;
}
