summaryrefslogblamecommitdiff
path: root/npc/merchants/advanced_refiner.txt
blob: e75912f4cf219b98bf8345a9ab37027d06a2ce5d (plain) (tree)





























                                                                           
                    
                                                                           
                                                                





                                                                           

                                            


                                                                           
 
                                                
                      
                       
                                



                                                 
 
                                                                                                                                     

                                      
                                             

                                                                                          
                 
                               
         


                                                                       
                      
         
                                 
 


                                                      
                               
                                                                               

                      
                                                
                               
                                                                                                     

                      
 

                                                                                
                                          




                                                                            

         



                                                                                                         
                     
                              
                               

                                                                                                                                                                         

                      
                             
             
                                        
                       
                                   

                       



                                                                    
              



                       


                                                                                                                               
             
                                      















                                                                                                         
                                                              





                                                                                                                                   
                                               







                                                                                                                      
                                                              




                                                                                         

                         

                                                                   
                                          

                               
                               

                                                                                                                                                

                      
                       
                                                                   
              
 
//================= Hercules Script =======================================
//=       _   _                     _
//=      | | | |                   | |
//=      | |_| | ___ _ __ ___ _   _| | ___  ___
//=      |  _  |/ _ \ '__/ __| | | | |/ _ \/ __|
//=      | | | |  __/ | | (__| |_| | |  __/\__ \
//=      \_| |_/\___|_|  \___|\__,_|_|\___||___/
//================= License ===============================================
//= This file is part of Hercules.
//= http://herc.ws - http://github.com/HerculesWS/Hercules
//=
//= Copyright (C) 2012-2015  Hercules Dev Team
//= Copyright (C)  Euphy
//= Copyright (C)  Yommy
//= Copyright (C)  Zephyrus
//= Copyright (C)  L0ne_W0lf
//=
//= 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/>.
//=========================================================================
//= Advanced Refiner
//================= Description ===========================================
//= Refiner that uses Enriched ores to increase upgrade success.
//================= Additional Comments ===================================
//= After a conversation with Doddler, it's been established that the
//= advanced refiner works similar the the "Bubble Gum" item.
//= The success percentage is not "increased" however, if it fails you get
//= a second try. This tries twice at the same time, effectively giving you
//= a re-roll on your attempt.
//= - Dialog is only partly official to iRO.
//= - Uses the iRO position for this NPC.
//================= Current Version =======================================
//= 1.5
//=========================================================================

payon,157,146,6	script	Suhnbi#cash	4_M_03,{
	disable_items;
	mes "[Suhnbi]";
	mes "I am the Armsmith";
	mes "I can refine all kinds of weapons,";
	mes "armor and equipment, so let me";
	mes "know what you want to refine.";
	next;

	setarray .@position$[1], "Head","Body","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
	.@menu$ = "";
	for(.@i = 1; .@i<=10; ++.@i) {
		if (getequipisequiped(.@i)) {
			.@menu$ += .@position$[.@i] + "-" + "[" + getequipname(.@i) + "]";
			.@equipped = 1;
		}
		.@menu$ += ":";
	}
	if (.@equipped == 0) {
		mes "[Suhnbi]";
		mes "I don't think I can refine any items you have...";
		close;
	}
	.@part = select(.@menu$);

	if (!getequipisequiped(.@part)) //custom check
		close;
	if (!getequipisenableref(.@part)) {
		mes "[Suhnbi]";
		mes "Go find another Blacksmith. You can't refine this thing.";
		close;
	}
	if (getequiprefinerycnt(.@part) >= 10) {
		mes "[Suhnbi]";
		mes "Hmm... someone perfected this already. I don't think I can work on it further.";
		close;
	}

	// Make sure you have the neccessary items and Zeny to refine your items
	// Determines chance of failure and verifies that you want to continue.
	switch(getequipweaponlv(.@part)) {
		case 1: callsub S_RefineValidate,1,7620,50,.@part; break;
		case 2: callsub S_RefineValidate,2,7620,200,.@part; break;
		case 3: callsub S_RefineValidate,3,7620,5000,.@part; break;
		case 4: callsub S_RefineValidate,4,7620,20000,.@part; break;
		default: callsub S_RefineValidate,0,7619,2000,.@part; break;
	}

	mes "[Suhnbi]";
	mes "Clang! Clang! Clang!";
	if (getequippercentrefinery(.@part) > rand(100) || getequippercentrefinery(.@part) > rand(100)) {
		successrefitem .@part;
		next;
		emotion e_no1;
		mes "[Suhnbi]";
		mes "There you go! It's done.";
		mes "It's been a while since I've made such a fine "+((getequipweaponlv(.@part))?"weapon":"armor")+". You must be happy because it has become stronger!";
		close;
	}
	failedrefitem .@part;
	next;
	emotion (!rand(5))?e_cash:e_omg;
	mes "[Suhnbi]";
	mes "Uuuuuuuuuummmmmph!!!";
	next;
	mes "[Suhnbi]";
	mes "...";
	mes ".....";
	mes ".......Huhuhuhuhu~";
	mes "........It was your choice and my ability, no regret.";
	close;

S_RefineValidate:
	mes "[Suhnbi]";
	if (getarg(0))
		mes "You want to refine a level " + getarg(0) + " weapon?";
	mes "To refine that, you'll need to have one ^ff9999" + getitemname(getarg(1)) + "^000000 and " + getarg(2) + " zeny.";
	mes "Would you like to continue?";
	next;
	if(select("Yes", "No") == 1) {
		if (getequippercentrefinery(getarg(3)) < 100) {
			if (getarg(0)) {
				mes "[Suhnbi]";
				mes "Wow!!";
				mes "This weapon probably";
				mes "looks like it's been refined...";
				mes "many times...";
				mes "It may break if";
				mes "you refine it again.";
				next;
				mes "And if it breaks,";
				mes "you can't use it anymore!";
				mes "All the cards in it and the properties ^ff0000will be lost^000000!";
				mes "^ff0000Besides, the equipment will break!^000000";
				mes "Are you sure you still want to continue?";
				next;
				if(select("Yes", "No") == 2) {
					mes "[Suhnbi]";
					mes "Good.";
					mes "Because if the weapon breaks from unreasonable refining, then I get a bad mood, too.";
					close;
				}
			} else {
				mes "[Suhnbi]";
				mes "Giggle. Giggle. Oh, you have guts, daring to refine this.";
				mes "You know it's pretty risky, don't you?";
				next;
				mes "If your defensive equipment is broken, you'll never be able to use it again.";
				mes "Even your cards and your modifications will ^ff0000completely disappear^000000.";
				//mes "Everything will disappear. As in... GONE!";
				mes "Do you really wish to continue?";
				next;
				if(select("Yes", "No") == 2) {
					mes "[Suhnbi]";
					mes "What nonsense. You waste my precious time.";
					mes "Get lost, punk.";
					close;
				}
			}
		}
		if (countitem(getarg(1)) > 0 && Zeny > getarg(2)) {
			delitem getarg(1),1;
			Zeny -= getarg(2);
			return;
		}
		mes "[Suhnbi]";
		mes "Are these all you have?";
		mes "I'm very sorry, but I can't do anything without all the materials. Besides, I deserve some payments for my work, don't I?";
		close;
	}
	mes "[Suhnbi]";
	mes "I can't help it even if you're not happy about it...";
	close;
}