//===== rAthena Script =======================================
//= Clan masters
//===== Description: =========================================
//= The clan master NPCs that allow you to join and leave
//= one of the clans.
//===== Changelogs: ==========================================
//= 1.0 Initial release. [Lemongrass]
//= 1.1 iRO translation. [RagnarokNova]
//= 1.2 Dialogue cleanup. [Aleos]
//= 1.3 Added clan helper. [exneval]
//============================================================

prontera,138,183,7	script	Clan Helper	703,{
	mes "[Clan Helper]";
	mes "Do you want to build connections without being in a guild?";
	next;
	mes "[Clan Helper]";
	mes "Can't find the perfect guild for yourself?";
	next;
	mes "[Clan Helper]";
	mes "You can join or leave clans freely! Just join!";
	next;
	mes "[Clan Helper]";
	mes "Now, come on in and meet the masters of the Kingdom's best clans!";
	close;
}

prt_in,33,114,5	script	Raffam Oranpere	10058,{
	cutin "laperm01.bmp", 2;
	mes "[Raffam Oranpere]";
	mes "Hi! I'm Raffam, master of the ^3131FFSword Clan^000000 in the Rune-Midgarts Kingdom.";
	next;
	switch( select( "Clan Information:Join.:Leave." ) ){
		case 1:
			switch( select( "What are Clans?:About the Sword Clan:Cancel." ) ){
				case 1:
					mes "[Raffam Oranpere]";
					mes "The ^3131FFClans^000000 are a type of guild ran by the Kingdom.";
					mes "They don't participate in the Siege, so members are free to join/leave anytime.";
					next;
					mes "[Raffam Oranpere]";
					mes "I wish we could join the Siege. I'd love flying over on my dragon and burning everyone in my way!";
					mes "Oops, too thrilled!";
					next;
					mes "[Raffam Oranpere]";
					mes "Join us, if no Clan suits your taste.";
					mes "New members are given ^3131FFfree stat bonuses^000000.";
					next;
					mes "[Raffam Oranpere]";
					mes "Melee stats are offered as the name ^3131FFSword Clan^000000 suggests, but not all members are Melee classes.";
					mes "Don't feel pressured, just count on me!";
					next;
					cutin "laperm02.bmp", 2;
					mes "[Raffam Oranpere]";
					mes "Differences in variety creates the fun.";
					mes "These odd bunches never bore me in the party.";
					next;
					mes "[Raffam Oranpere]";
					mes "And who knows you might meet your soul mate in the Clan? Hahah!";
					break;
				case 2:
					mes "[Raffam Oranpere]";
					mes "The ^3131FFSword Clan^000000 mainly supports Melee adventurers.";
					mes "Join for free ^FF0000<STR+1, VIT+1, MHP+30, MSP+10>^000000!";
					next;
					mes "[Raffam Oranpere]";
					mes "Remember, no Siege participation.";
					mes "You should contact other guilds for Siege.";
					next;
					mes "[Raffam Oranpere]";
					mes "A question?";
					mes "Excited to join me? Hahah!";
					break;
				case 3:
					break;
			}			
			break;
		case 2:
			mes "[Raffam Oranpere]";
			mes "Oh, you'll join? Good choice!";
			mes "Let's check the Clan policy then to begin admission procedures.";
			next;
			mes "[Raffam Oranpere]";
			mes "^3131FFClansmen^000000 cannot participate in the Siege.";
			mes "New members are given these stat bonuses: ^FF0000<STR+1, VIT+1, MHP+30, MSP+10>^000000.";
			mes "You with me so far?";
			next;
			if( select( "Yes.:No." ) == 1 ){
				mes "[Raffam Oranpere]";
				mes "You can join and leave a Clan anytime, but if you don't login for ^FF0000more than 2 weeks^000000, you'll be ^FF0000expelled^000000.";
				mes "Clan masters exist for reason, like I.";
				mes "Understood?";
				next;
				if( select( "Yes.:No." ) == 1 ){
					mes "[Raffam Oranpere]";
					mes "Great, sign your name here to register.";
					next;
					input .@name$;
					mes "[Raffam Oranpere]";
					mes "So, you're ^3131FF" + strcharinfo( 0 ) + "^000000! Nice name!";
					mes "Let me register you.";
					next;
					if( getcharid( 2 ) ){
						mes "[Raffam Oranpere]";
						mes "Come back to join after you leave your current guild.";
						close;
					}else if( getcharid( 5 ) != 0 ){
						cutin "laperm04.bmp", 2;
						mes "[Raffam Oranpere]";
						mes "Eh? Oh, you're in a Clan.";
						mes "Don't mess with me, it's not cool!";
					}else{
						cutin "laperm02.bmp", 2;
						if (clan_join(SWORDCLAN)) {
							sc_start2 SC_SWORDCLAN, INFINITE_TICK, 0, SWORDCLAN;
							mes "[Raffam Oranpere]";
							mes "Welcome to the ^3131FFSword Clan^000000!";
							mes "You can review Clan info with ^3131FFCtrl+G^000000.";
							mes "At your service!";
						} else
							mes "An error has occurred.";
					}
				}else{
					mes "[Raffam Oranpere]";
					mes "Uh, oh. Let's go back to the beginning.";
				}
			}else{
				cutin "laperm03.bmp", 2;
				mes "[Raffam Oranpere]";
				mes "Uh, oh. Let's go back to the beginning.";
			}
			break;
		case 3:
			cutin "laperm01.bmp", 2;
			mes "[Raffam Oranpere]";
			mes "You want to leave?";
			mes "No problem. I hope you'll find a more suitable Clan.";
			mes "Ready for withdrawal?";
			next;
			if( select( "Continue.:Cancel." ) == 1 ){
				if( getcharid( 5 ) == 0 ){
					cutin "laperm04.bmp", 2;
					mes "[Raffam Oranpere]";
					mes "Wait, you're not with us! Grr, don't make me breathe fire at you!";
				}else if( getcharid( 5 ) != SWORDCLAN ){
					cutin "laperm04.bmp", 2;
					mes "[Raffam Oranpere]";
					mes "Hey, talk to your guild master if you want to leave.";
				}else{
					if (clan_leave()) {
						sc_end SC_SWORDCLAN;
						mes "[Raffam Oranpere]";
						mes "Okay, it's done. But let's not be strangers, okay?";
						mes "It was nice having you!";
					} else
						mes "An error has occurred.";
				}
			}
			break;
	}
	close2;
	cutin "", 255;
	end;

OnInit:
	sc_start2 SC_SWORDCLAN, INFINITE_TICK, 0, SWORDCLAN, 10000, SCSTART_NOAVOID, getnpcid(0);
	end;
}

prt_in,35,114,5	script	Devon Aire	10059,{
	cutin "debon01.bmp", 2;
	mes "[Devon Aire]";
	mes "I'm Devon, master of the ^3131FFArc Wand Clan^000000.";
	next;
	switch( select( "Clan Information:Join.:Leave." ) ){
		case 1:
			switch( select( "What are Clans?:About the Arc Wand Clan:Cancel." ) ){
				case 1:
					mes "[Devon Aire]";
					mes "The ^3131FFClans^000000 are ran by the Kingdom, not privately like others.";
					mes "And I manage one of them.";
					next;
					cutin "debon02.bmp", 2;
					mes "[Devon Aire]";
					mes "...";
					mes "What's with that look? You got a problem?";
					next;
					cutin "birman01.bmp", 2;
					mes "[Berman Aire]";
					mes "Brother, you're scaring a potential member, be nice.";
					next;
					cutin "debon02.bmp", 2;
					mes "[Devon Aire]";
					mes "...";
					next;
					cutin "debon01.bmp", 2;
					mes "[Devon Aire]";
					mes "Join if you are seeking a place to fit in. We give ^3131FFfree bonus stats^000000. But no Siege participation.";
					next;
					mes "[Devon Aire]";
					mes "Most members are offensive Mage classes as the name ^3131FFArc Wand Clan^000000 suggests, but that's no requirement.";
					next;
					cutin "debon02.bmp", 2;
					mes "[Devon Aire]";
					mes "...Hey, Shaam Rumi.";
					mes "Stop hitting on my brother and get to work.";
					next;
					cutin "sham03.bmp", 2;
					mes "[Shaam Rumi]";
					mes "Whatever!";
					next;
					cutin "debon02.bmp", 2;
					mes "[Devon Aire]";
					mes "...Hmpf!";
					mes "Listen, Crossbow Clan's master is evil.";
					next;
					cutin "sham02.bmp", 2;
					mes "[Shaam Rumi]";
					mes "Get over me, Devon! Don't spread rumors!";
					next;
					cutin "birman01.bmp", 2;
					mes "[Berman Aire]";
					mes "Haha. Stop it. You two are making a scene.";
					mes "Come on, back to work guys.";
					break;
				case 2:
					cutin "debon01.bmp", 2;
					mes "[Devon Aire]";
					mes "The ^3131FFArc Wand Clan^000000 mainly supports offensive Mage classes.";
					mes "We offer ^FF0000<INT+1, DEX+1, MHP+30, MSP+10>^000000 to new members. Don't ask for more; it's the Kingdom's rule.";
					next;
					mes "[Devon Aire]";
					mes "^3131FFClansmen^000000 can't participate in the Siege.";
					mes "If you like the Siege, then go join a regular guild.";
					next;
					mes "[Devon Aire]";
					mes "That is all. No questions.";
					break;
				case 3:
					break;
			}
			break;
		case 2:
			cutin "debon01.bmp", 2;
			mes "[Devon Aire]";
			mes "...";
			mes "Let's check the Clan policy then to begin admission procedures.";
			next;
			mes "[Devon Aire]";
			mes "^3131FFClansmen^000000 cannot participate in the Siege.";
			mes "New members are given these stat bonuses: ^FF0000<INT+1, DEX+1, MHP+30, MSP+10>^000000.";
			mes "You with me so far?";
			next;
			if( select( "Yes.:No." ) == 1 ){
				mes "[Devon Aire]";
				mes "You can join and leave a Clan anytime, but if you don't login for ^FF0000more than 2 weeks^000000, you'll be ^FF0000expelled^000000.";
				mes "Do you agree?";
				next;
				if( select( "Yes.:No." ) == 1 ){
					mes "[Devon Aire]";
					mes "Sign your name here.";
					next;
					input .@name$;
					mes "[Devon Aire]";
					mes "^3131FF" + strcharinfo( 0 ) + "^000000.....";
					mes "Good, let me invite you in.";
					next;
					if( getcharid( 2 ) ){
						mes "[Devon Aire]";
						mes "Leave your guild first to join my Clan, duh.";
						close;
					}else if( getcharid( 5 ) != 0 ){
						cutin "debon03.bmp", 2;
						mes "[Devon Aire]";
						mes "You're already in a Clan. You joking?!";
						mes "Oh, I can be funny, too--FIRE PILLAR!";
					}else{
						if (clan_join(ARCWANDCLAN)) {
							sc_start2 SC_ARCWANDCLAN, INFINITE_TICK, 0, ARCWANDCLAN;
							mes "[Devon Aire]";
							mes "You have joined the ^3131FFArc Wand Clan^000000.";
							next;
							mes "[Devon Aire]";
							mes "You can review Clan info with ^3131FFCtrl+G^000000.";
							mes "So don't bother me later.";
							next;
							mes "[Devon Aire]";
							mes "That's all. Visit often or be expelled. Dismissed.";
						} else
							mes "An error has occurred.";
					}
				}else{
					mes "[Devon Aire]";
					mes "Then I don't want you.";
				}
			}else{
				mes "[Devon Aire]";
				mes "Gosh, listen to the policy again.";
			}
			break;
		case 3:
			mes "[Devon Aire]";
			mes "Want to leave, huh?";
			mes "I understand, it's about Sieges. If not, why are..Never mind..";
			mes "I'll process your withdrawal.";
			next;
			if( select( "Continue.:Cancel." ) == 1 ){
				if( getcharid( 5 ) == 0 ){
					cutin "debon03.bmp", 2;
					mes "[Devon Aire]";
					mes "Naughty children deserve a good Jupitel Thunder.";
				}else if( getcharid( 5 ) != ARCWANDCLAN ){
					cutin "debon02.bmp", 2;
					mes "[Devon Aire]";
					mes "You're barking up the wrong tree. Go to your Clan master.";
				}else{
					if (clan_leave()) {
						sc_end SC_ARCWANDCLAN;
						mes "[Devon Aire]";
						mes "You are withdrawn from the Clan.";
						mes "Now leave. I don't feel like talking anymore.";
					} else
						mes "An error has occurred.";
				}
			}		
			break;
	}
	close2;
	cutin "", 255;
	end;

OnInit:
	sc_start2 SC_ARCWANDCLAN, INFINITE_TICK, 0, ARCWANDCLAN, 10000, SCSTART_NOAVOID, getnpcid(0);
	end;
}

prt_in,37,114,5	script	Berman Aire	10060,{
	cutin "birman01.bmp", 2;
	mes "[Berman Aire]";
	mes "Nice to meet you. I'm Berman Aire, master of the ^3131FFGolden Mace Clan^000000.";
	mes "I'm also the older brother of Devon Aire. Devon looks tough, but he's kind hearted.";
	next;
	switch( select( "Clan Information:Join.:Leave." ) ){
		case 1:
			switch( select( "What are Clans?:About the Golden Mace Clan:Cancel." ) ){
				case 1:
					mes "[Berman Aire]";
					mes "The ^3131FFClans^000000 are established by the Kingdom to help adventurers connect and share information.";
					next;
					mes "[Berman Aire]";
					mes "Because the Kingdom runs the Clan, there is no Siege participation, but at least the members are given ^3131FFstat bonuses^000000.";
					mes "The stat bonuses are small, but can be very useful for beginning adventurers.";
					next;
					mes "[Berman Aire]";
					mes "We're named the ^3131FFGolden Mace Clan^000000, but we don't discriminate against applicants based on their classes.";
					mes "The name is just to help you easily choose your Clan.";
					next;
					cutin "sham02.bmp", 2;
					mes "[Shaam Rumi]";
					mes "Berman, enough with the explanation. Let's go hang out in Glast Heim.";
					next;
					cutin "debon03.bmp", 2;
					mes "[Devon Aire]";
					mes "... Hey.";
					next;
					cutin "sham03.bmp", 2;
					mes "[Shaam Rumi]";
					mes "Ooh, you're scaring me.";
					mes "Berman, call me when you can!~";
					next;
					cutin "birman03.bmp", 2;
					mes "[Berman Aire]";
					mes "Hah hah, I apologize for their bickering.";
					next;
					cutin "birman01.bmp", 2;
					mes "[Berman Aire]";
					mes "Do you have a question?";
					mes "If you're tired of traveling alone, join us! You can join and leave the Clan anytime you want.";
					break;
				case 2:
					mes "[Berman Aire]";
					mes "The ^3131FFGolden Mace Clan^000000 mainly helps supportive classes.";
					mes "We offer ^FF0000<INT+1, LUK+1, MHP+30, MSP+10>^000000 to new members.";
					next;
					mes "[Berman Aire]";
					mes "As I told you earlier, Clans cannot join the Siege because they already belong to the Kingdom.";
					mes "If you want to be in the Siege, then I recommend you join a regular guild.";
					next;
					mes "[Berman Aire]";
					mes "Do you understand what the Clans are about now?";
					break;
				case 3:
					break;
			}
			break;
		case 2:
			mes "[Berman Aire]";
			mes "Great!";
			mes "Let's check the Clan policy then to begin admission procedures.";
			next;
			mes "[Berman Aire]";
			mes "^3131FFClansmen^000000 cannot participate in the Siege.";
			mes "As our new member, you'll receive the following stat bonuses: ^FF0000<INT+1, LUK+1, MHP+30, MSP+10>^000000.";
			mes "Do you agree?";
			next;
			if( select( "Yes.:No." ) == 1 ){
				mes "[Berman Aire]";
				mes "You can join and leave a Clan anytime, but if you don't login for ^FF0000more than 2 weeks^000000, you'll be ^FF0000expelled^000000.";
				mes "Do you agree to maintain good standing in the Clan?";
				next;
				if( select( "Yes.:No." ) == 1 ){
					mes "[Berman Aire]";
					mes "Now, please write your name here.";
					next;
					input .@name$;
					mes "[Berman Aire]";
					mes "^3131FF" + strcharinfo( 0 ) + "^000000! What a good name!";
					mes "Okay, then...";
					next;
					if( getcharid( 2 ) ){
						mes "[Berman Aire]";
						mes "Oh, no.";
						mes "In order to join, you first have to leave your current guild.";
						close;
					}else if( getcharid( 5 ) != 0 ){
						mes "[Berman Aire]";
						mes "You're already in a Clan.";
						mes "You're just confused, right?";
					}else{
						if (clan_join(GOLDENMACECLAN)) {
							sc_start2 SC_GOLDENMACECLAN, INFINITE_TICK, 0, GOLDENMACECLAN;
							cutin "birman02.bmp", 2;
							mes "[Berman Aire]";
							mes "Welcome to the ^3131FFGolden Mace Clan^000000!";
							next;
							mes "[Berman Aire]";
							mes "You can review Clan info with ^3131FFCtrl+G^000000.";
							next;
							mes "[Berman Aire]";
							mes "Please remember the few precautions I gave you, and enjoy your Clan activities!";
						} else
							mes "An error has occurred.";
					}
				}
			}
			break;
		case 3:
			mes "[Berman Aire]";
			mes "With meeting, there is parting.";
			mes "I hope you enjoyed your time in the ^3131FFGolden Mace Clan^000000.";
			mes "Now, should I process your withdrawal?";
			next;
			if( select( "Continue.:Cancel." ) == 1 ){
				if( getcharid( 5 ) == 0 ){
					mes "[Berman Aire]";
					mes "You can't leave the Clan without joining it first.";
				}else if( getcharid( 5 ) != GOLDENMACECLAN ){
					mes "[Berman Aire]";
					mes "I'm sorry, but I can't remove you from another Clan...";
				}else{
					if (clan_leave()) {
						sc_end SC_GOLDENMACECLAN;
						mes "[Berman Aire]";
						mes "It's processed.";
						mes "Come back anytime to the ^3131FFGolden Mace Clan^000000. I'll be here.";
					} else
						mes "An error has occurred.";
				}
			}
			break;
	}
	close2;
	cutin "", 255;
	end;

OnInit:
	sc_start2 SC_GOLDENMACECLAN, INFINITE_TICK, 0, GOLDENMACECLAN, 10000, SCSTART_NOAVOID, getnpcid(0);
	end;
}

prt_in,39,114,5	script	Shaam Rumi	10027,{
	cutin "sham01.bmp", 2;
	mes "[Shaam Rumi]";
	mes "Hi, there! I'm Shaam, master of the ^3131FFCrossbow Clan^000000";
	mes "What can I do for you?";
	next;
	switch( select( "Clan Information:Join.:Leave." ) ){
		case 1:
			switch( select( "What are Clans?:About the Crossbow Clan:Cancel." ) ){
				case 1:
					mes "[Shaam Rumi]";
					mes "The Clans were established by the Rune-Midgarts Kingdom to...";
					mes "Raffam, why were our ^3131FFclans^000000 made?";
					next;
					cutin "laperm01.bmp", 2;
					mes "[Raffam Oranpere]";
					mes "Did you sleep in class? Gosh.";
					mes "The Clans help lone adventurers connect with each other and share information.";
					next;
					cutin "sham01.bmp", 2;
					mes "[Shaam Rumi]";
					mes "A-ha, got it! Thank you, Captain!";
					mes "You heard that too, right?";
					next;
					mes "[Shaam Rumi]";
					mes "Run by the Kingdom itself, the Clans are not allowed to participate in the Siege, but the good news is that the members are given some ^3131FFstat bonuses^000000.";
					next;
					mes "[Shaam Rumi]";
					mes "In case you wonder if the ^3131FFCrossbow Clan^000000 only recruits Archers, no, it doesn't.";
					mes "All the Clans accept all classes. You can choose the one that suits your needs best.";
					next;
					cutin "sham02.bmp", 2;
					mes "[Shaam Rumi]";
					mes "That should cover everything there is to know.";
					mes "Berman, let's go hang out in Glast Heim.";
					next;
					cutin "debon03.bmp", 2;
					mes "[Devon Aire]";
					mes "You...";
					next;
					cutin "sham03.bmp", 2;
					mes "[Shaam Rumi]";
					mes "Ooh, scary! You're so protective of your brother.";
					break;
				case 2:
					mes "[Shaam Rumi]";
					mes "The ^3131FFCrossbow Clan^000000 is ideal for ranged classes.";
					next;
					mes "[Shaam Rumi]";
					mes "Eh, let me check the Clan manual. Ah, and we offer stat bonuses to new members: ^FF0000<DEX+1, AGI+1, MHP+30, MSP+10>^000000.";
					next;
					mes "[Shaam Rumi]";
					mes "The Clans are not allowed to participate in the Siege; you should join a private guild instead for Siege.";
					mes "The Clans are for adventurers that hate being tied down.";
					next;
					mes "[Shaam Rumi]";
					mes "Do you have a question?";
					break;
				case 3:
					break;
			}
			break;
		case 2:
			mes "[Shaam Rumi]";
			mes "Oh, yeah? Good choice!";
			mes "Let's check the Clan policy then to begin admission procedures.";
			next;
			mes "[Shaam Rumi]";
			mes "^3131FFClansmen^000000 cannot participate in the Siege.";
			mes "As our new member, you'll receive the following stat bonuses: ^FF0000<DEX+1, AGI+1, MHP+30, MSP+10>^000000.";
			mes "Do you agree?";
			next;
			if( select( "Yes.:No." ) == 1 ){
				mes "[Shaam Rumi]";
				mes "You can join and leave a Clan anytime, but if you don't login for ^FF0000more than 2 weeks^000000, you'll be ^FF0000expelled^000000.";
				mes "Do you promise you'll maintain good standing?";
				next;
				if( select( "Yes.:No." ) == 1 ){
					mes "[Shaam Rumi]";
					mes "Good, write your name here.";
					next;
					input .@name$;
					mes "[Shaam Rumi]";
					mes "^3131FF" + strcharinfo( 0 ) + "^000000..!";
					mes "Ugh, your penmanship needs work. Let me process your application.";
					next;
					if( getcharid( 2 ) ){
						mes "[Shaam Rumi]";
						mes "Did you finish things up with your guild?";
						close;
					}else if( getcharid( 5 ) != 0 ){
						mes "[Shaam Rumi]";
						mes "Eh, you're already in a Clan. Hey, this isn't funny.";
					}else{
						if (clan_join(CROSSBOWCLAN)) {
							sc_start2 SC_CROSSBOWCLAN, INFINITE_TICK, 0, CROSSBOWCLAN;
							cutin "sham02.bmp", 2;
							mes "[Shaam Rumi]";
							mes "Welcome to the ^3131FFCrossbow Clan^000000!";
							next;
							cutin "sham01.bmp", 2;
							mes "[Shaam Rumi]";
							mes "You can review Clan info with ^3131FFCtrl+G^000000.";
							next;
							mes "[Shaam Rumi]";
							mes "Don't pick fights with other clansmen. Be social.";
							mes "If you need help, you can always whisper me, okay? See you around!";
						} else
							mes "An error has occurred.";
					}
				}else{
					mes "[Shaam Rumi]";
					mes "All right then. I'm just going to go have some fun.";
				}
			}else{
				mes "[Shaam Rumi]";
				mes "Ah, do you need time to think about this? No problem.";
			}
			break;
		case 3:
			mes "[Shaam Rumi]";
			mes "Why, did you find a better Clan?";
			mes "I'm disappointed, but it's your call. Let me process your withdrawal.";
			next;
			if( select( "Continue.:Cancel." ) == 1 ){
				if( getcharid( 5 ) == 0 ){
					cutin "sham04.bmp", 2;
					mes "[Shaam Rumi]";
					mes "I can't let you leave--you're not even in my Clan!";
				}else if( getcharid( 5 ) != CROSSBOWCLAN ){
					mes "[Shaam Rumi]";
					mes "Sorry, but I don't meddle with other Clans' business.";
				}else{
					if (clan_leave()) {
						sc_end SC_CROSSBOWCLAN;
						mes "[Shaam Rumi]";
						mes "It's done.";
						mes "If you ever miss us, don't hesitate to come back, alright?";
					} else
						mes "An error has occurred.";
				}
			}
			break;
	}
	close2;
	cutin "", 255;
	end;

OnInit:
	sc_start2 SC_CROSSBOWCLAN, INFINITE_TICK, 0, CROSSBOWCLAN, 10000, SCSTART_NOAVOID, getnpcid(0);
	end;
}
