Jump to content
  • 0

Help with normal refiner


agamanaros

Question


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  38
  • Reputation:   0
  • Joined:  03/26/16
  • Last Seen:  

I'm having a bit of troubles with my normal refiner, I never change nor touch anything in the script but the menu's of the npc are all messed up and also when I try to refine an item it says "I don't think I can refine this item at all...."

Please help me,
Thank you very much

// Weapon/Armor Refiners
//============================================================
prt_in,63,60,0	script	Hollgrehenn	85,{
	callfunc "refinemain","Hollgrehenn",0;
	end;
}
morocc_in,73,38,6	script	Aragham	99,{
	callfunc "refinemain","Aragham",0;
	end;
}
payon,144,173,5	script	Antonio	88,{
	callfunc "refinemain","Antonio",0;
	end;
}
alberta_in,28,58,0	script	Fredrik	85,{
	callfunc "refinemain","Fredrik",0;
	end;
}
yuno_in01,171,21,4	script	Lambert	88,{
	callfunc "refinemain","Lambert",0;
	end;
}
ein_in01,24,87,5	script	Manthasman	826,{
	callfunc "refinemain","Manthasman Pruhag",0;
	end;
}
lhz_in02,282,20,7	script	Fulerr	869,{
	callfunc "refinemain","Fulerr",0;
	end;
}

//============================================================
//= Main Refiner Function
//============================================================
//= To allow auto safe refining/multiple refining set the
//= second argument to '1' in the function call.
//= If you enable this function, be sure to edit the value of
//= .@safe to the max safe refine in refine_db.txt as well.
//============================================================
function	script	refinemain	{
	disable_items;
	.@npc_name$ = getarg(0);
	set .@features,getarg(1);
	mes "["+ .@npc_name$ +"]";
	mes "I'm the Armsmith.";
	mes "I can refine all kinds of weapons, armor and equipment, so let me";
	mes "know what you want me to refine.";
	next;

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

	if(!getequipisequiped(.@part)) { //custom check
		mes "["+ .@npc_name$ +"]";
		mes "You're not wearing";
		mes "anything there that";
		mes "I can refine.";
		emotion e_an;
		close;
	}
	//Check if the item is refinable...
	if(!getequipisenableref(.@part)) {
		mes "["+ .@npc_name$ +"]";
		mes "I don't think I can";
		mes "refine this item at all...";
		close;
	}
	//Check to see if the items is already +10
	if(getequiprefinerycnt(.@part) >= 10) {
		mes "["+ .@npc_name$ +"]";
		mes "I can't refine this";
		mes "any more. This is as";
		mes "refined as it gets!";
		close;
	}
	set .@refineitemid, getequipid(.@part); // save id of the item
	set .@refinerycnt, getequiprefinerycnt(.@part); //save refinery count
	switch(getequipweaponlv(.@part)){
	case 0: 	//Refine Armor
		set .@price,2000;
		set .@material,985; //Elunium
		set .@safe,4;
		break;
	case 1: 	//Refine Level 1 Weapon
		set .@price,50;
		set .@material,1010; //Phracon
		set .@safe,7;
		break;
	case 2: 	//Refine Level 2 Weapon
		set .@price,200;
		set .@material,1011; //Emveretarcon
		set .@safe,6;
		break;
	case 3: 	//Refine Level 3 Weapon
		set .@price,5000;
		set .@material,984; //Oridecon
		set .@safe,5;
		break;
	case 4: 	//Refine Level 4 Weapon
		set .@price,20000;
		set .@material,984; //Oridecon
		set .@safe,4;
		break;
	case 5: 	//Refine other stuff?
		set .@price,2000;
		set .@material,985; //Elunium
		set .@safe,4;
		break;
	}

	// If the VIP system is enabled, the prices for non-VIP players are considerably higher.
	if (VIP_SCRIPT && !vip_status(1)) {
		switch(getequipweaponlv(.@part)) {
			case 0: set .@price, .@price * 10; break;
			case 1: set .@price, .@price * 40; break;
			case 2: set .@price, .@price * 50; break;
			case 3: set .@price, .@price * 2; break;
			case 4: set .@price, .@price * 2; break;
			case 5: set .@price, .@price * 10; break;
		}
	}

	if(.@features != 1) {
		mes "["+ .@npc_name$ +"]";
		mes "To refine this I need";
		mes "one ^003366"+getitemname(.@material)+"^000000 and";
		mes "a service fee of " + .@price + " Zeny.";
		mes "Do you really wish to continue?";
		next;
		if(select("Yes:No") == 2){
			mes "["+ .@npc_name$ +"]";
			mes "Yeah...";
			mes "There's no need to";
			mes "rush. Take your time.";
			close;
		}
		if(getequippercentrefinery(.@part) < 100) {
			mes "["+ .@npc_name$ +"]";
			mes "Oh no! If I continue to";
			mes "refine this, there's a risk it could";
			switch(.@material) {
			case 985:
				mes "be destroyed! That means that ^FF0000this equipment^000000, and ^FF0000any cards^000000 or special properties added to this armor, ^FF0000will be gone^000000.";
				break;
			default:
				mes "be destroyed, and you'd ^FF0000lose the weapon^000000, any ^FF0000cards in the weapon^000000,";
				mes "or any added special properties.";
				break;
			}
			next;
			mes "["+getarg(0)+"]";
			mes "I can't make it any clearer.";
			mes "Once a weapon is destroyed,";
			mes "there's no getting it back.";
			mes "You really have a chance to";
			mes "^FF0000lose this weapon^000000 forever.";
			mes "Do you still want to refine?";
			next;
			if(select("Yes:No") == 2){
				mes "["+ .@npc_name$ +"]";
				mes "I completely agree...";
				mes "I might be a great refiner, but sometimes even I make mistakes.";
				close;
			}
		}
		if((countitem(.@material) < 1) || (Zeny < .@price)) {
			mes "["+ .@npc_name$ +"]";
			mes "You don't seem to have";
			mes "enough Zeny or "+getitemname(.@material)+"...";
			mes "Go get some more. I'll be";
			mes "here all day if you need me.";
			close;
		}
		set Zeny, Zeny-.@price;
		delitem .@material,1;

		// anti-hack
		if (callfunc("F_IsEquipIDHack", .@part, .@refineitemid) ||
		    callfunc("F_IsEquipRefineHack", .@part, .@refinerycnt)) {
			mes "["+ .@npc_name$ +"]";
			emotion e_an;
			mes "Wait a second...";
			mes "Do you think I'm stupid?!";
			mes "You switched the item while I wasn't looking! Get out of here!";
			close;
		}

		if(getequippercentrefinery(.@part) <= rand(100)) {
			failedrefitem .@part;
			mes "["+ .@npc_name$ +"]";
			emotion (!rand(5))?e_cash:e_omg;
			set .@lose,rand(1,3);
			if (.@lose == 1) {
				mes "OH! MY GOD!";
				mes "Damn it! Not again!";
				mes "I'm terribly sorry, but you know practice does make perfect.";
				mes "Um, right? Heh heh...";
			} else if(.@lose == 2) {
				mes "Nooooooo!";
				mes "It broke!";
				mes "I-I'm sorry!";
			} else {
				mes "Crap!";
				mes "It couldn't take";
				mes "much more tempering!";
				mes "Sorry about this...";
			}
			close;
		}
		mes "["+getarg(0)+"]";
		successrefitem .@part;
		emotion e_heh;
		set .@win,rand(1,3);
		if (.@win == 1) {
			mes "Perfect!";
			mes "Heh heh!";
			mes "Once again,";
			mes "flawless work";
			mes "from the master~";
		} else if(.@win == 2) {
			mes "Success...!";
			mes "Yet again, my amazing";
			mes "talent truly dazzles";
			mes "and shines today.";
		} else {
			mes "Heh heh!";
			mes "I'm all done.";
			mes "No doubt, my work is";
			mes "to your satisfaction.";
			mes "Sheer, utter perfection~";
		}
		close;
	}

// New Refining Functions ========================
	if(getequiprefinerycnt(.@part) < .@safe) {
		mes "["+ .@npc_name$ +"]";
		mes "I can refine this to the safe limit or a desired number of times. It's your choice.";
		next;
		set .@menu2,select("To the safe limit, please.","I'll decide how many times.","I've changed my mind...");
	} else
		set .@menu2,2;
	switch(.@menu2){
	case 1: 
		set .@refinecnt,.@safe - getequiprefinerycnt(.@part);
		break;
	case 2:
		next;
		mes "["+ .@npc_name$ +"]";
		mes "How many times would you like me to refine your item?";
		next;
		input .@refinecnt;
		set .@refinecheck,.@refinecnt + getequiprefinerycnt(.@part);
		if (.@refinecnt < 1 || .@refinecheck > 10) {
			mes "["+ .@npc_name$ +"]";
			mes "I can't refine this item that many times.";
			close;
		}
		if(.@refinecheck > .@safe) {
			set .@refinecheck,.@refinecheck - .@safe;
			mes "["+ .@npc_name$ +"]";
			mes "This will try to refine the equipment " + .@refinecheck + " times past the safe limit. Your equipment may be destroyed... is that ok?";
			next;
			if(select("Yes...","No...") == 2){
				mes "["+ .@npc_name$ +"]";
				mes "You said so... So be it.";
				close;
			}
		}
		break;
	case 3:
		next;
		mes "["+ .@npc_name$ +"]";
		mes "You said so... So be it.";
		close;
	}
	set .@fullprice,.@price * .@refinecnt;
	mes "["+ .@npc_name$ +"]";
	mes "That will cost you " + .@refinecnt + " " + getitemname(.@material) + " and " + .@fullprice + " Zeny. Is that ok?";
	next;
	if(select("Yes","No...") == 2){
		mes "["+ .@npc_name$ +"]";
		mes "You said so... So be it.";
		close;
	}
	if(countitem(.@material) < .@refinecnt || Zeny < .@fullprice) {
		mes "["+ .@npc_name$ +"]";
		mes "Is that all you got? Unfortunately I can't work for you at a lower price. Try putting yourself in my shoes.";
		close;
	}
	set Zeny, Zeny - .@fullprice;
	delitem .@material,.@refinecnt;
	while(.@refinecnt){
		if (getequipisequiped(.@part) == 0) {
			mes "["+ .@npc_name$ +"]";
			mes "Look here... you don't have any items on...";
			close;
		}
		if (getequipid(.@part) != .@refineitemid || (.@menu2 == 1 && getequippercentrefinery(.@part) < 100)) {
			mes "["+ .@npc_name$ +"]";
			mes "Clang... No, but did you imagine I could be so stupid?!";
			mes "You changed it...";
			mes "Get out before I stun you with my Hammer!!";
			close;
		} 
		mes "Clang, clang!!!";
		if(.@menu2 == 2 && getequippercentrefinery(.@part) <= rand(100)) {
			failedrefitem .@part;
			emotion e_omg;
			mes "["+ .@npc_name$ +"]";
			mes "WAHHHH!!! I'm so sorry... I warned you this could happen...";
			set .@refinecnt,.@refinecnt - 1;
			if(.@refinecnt == 0) close;
			mes "Here's the unused Zeny and materials back...";
			getitem .@material,.@refinecnt;
			set .@fullprice,.@refinecnt * .@price;
			set Zeny, Zeny + .@fullprice;
			close;
		}
		successrefitem .@part;
		emotion e_no1;
		set .@refinecnt,.@refinecnt - 1;
		next;
	}
	mes "["+ .@npc_name$ +"]";
	mes "All finished... Come again soon.";
	close;

 

Capture.PNG

Capture1.PNG

Capture2.PNG

Capture3.PNG

Edited by agamanaros
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  38
  • Reputation:   0
  • Joined:  03/26/16
  • Last Seen:  

Up

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  22
  • Reputation:   11
  • Joined:  07/16/17
  • Last Seen:  

You are having troubles because the order of how the for loop checks the equipments isn't equal to your personal order.

Try this:

// Weapon/Armor Refiners
//============================================================
prt_in,63,60,0	script	Hollgrehenn	85,{
	callfunc "refinemain","Hollgrehenn",0;
	end;
}
morocc_in,73,38,6	script	Aragham	99,{
	callfunc "refinemain","Aragham",0;
	end;
}
payon,144,173,5	script	Antonio	88,{
	callfunc "refinemain","Antonio",0;
	end;
}
alberta_in,28,58,0	script	Fredrik	85,{
	callfunc "refinemain","Fredrik",0;
	end;
}
yuno_in01,171,21,4	script	Lambert	88,{
	callfunc "refinemain","Lambert",0;
	end;
}
ein_in01,24,87,5	script	Manthasman	826,{
	callfunc "refinemain","Manthasman Pruhag",0;
	end;
}
lhz_in02,282,20,7	script	Fulerr	869,{
	callfunc "refinemain","Fulerr",0;
	end;
}

//============================================================
//= Main Refiner Function
//============================================================
//= To allow auto safe refining/multiple refining set the
//= second argument to '1' in the function call.
//= If you enable this function, be sure to edit the value of
//= .@safe to the max safe refine in refine_db.txt as well.
//============================================================
function	script	refinemain	{
	disable_items;
	.@npc_name$ = getarg(0);
	set .@features,getarg(1);
	mes "["+ .@npc_name$ +"]";
	mes "I'm the Armsmith.";
	mes "I can refine all kinds of weapons, armor and equipment, so let me";
	mes "know what you want me to refine.";
	next;
	setarray .@equip_pos[1], EQI_HEAD_TOP, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, ,EQI_GARMENT, EQI_SHOES, EQI_ACC_R, EQI_ACC_L, EQI_HEAD_MID, EQI_HEAD_LOW;
	setarray .@position$[1], "Head", "Body", "Left hand", "Right hand", "Robe", "Shoes", "Accessory 1", "Accessory 2", "Head 2", "Head 3";
	for(.@i = 1; .@i <= getarraysize(.@position$); .@i++) {
		if(getequipisequiped(.@equip_pos[.@i])) {
			.@menu$ += .@position$[.@i] + "-" + "[" + getequipname(.@i) + "]";
			.@equipped = 1;
		}
		set .@menu$, .@menu$ + ":";
	}
	if (.@equipped == 0) {
		mes "["+ .@npc_name$ +"]";
		mes "I don't think I can refine any items you have...";
		close;
	}
	.@select = select(.@menu$);	
	.@part = .@equip_pos[.@select];
	if(!getequipisequiped(.@part)) { //custom check
		mes "["+ .@npc_name$ +"]";
		mes "You're not wearing";
		mes "anything there that";
		mes "I can refine.";
		emotion e_an;
		close;
	}
	//Check if the item is refinable...
	if(!getequipisenableref(.@part)) {
		mes "["+ .@npc_name$ +"]";
		mes "I don't think I can";
		mes "refine this item at all...";
		close;
	}
	//Check to see if the items is already +10
	if(getequiprefinerycnt(.@part) >= 10) {
		mes "["+ .@npc_name$ +"]";
		mes "I can't refine this";
		mes "any more. This is as";
		mes "refined as it gets!";
		close;
	}
	set .@refineitemid, getequipid(.@part); // save id of the item
	set .@refinerycnt, getequiprefinerycnt(.@part); //save refinery count
	switch(getequipweaponlv(.@part)){
	case 0: 	//Refine Armor
		set .@price,2000;
		set .@material,985; //Elunium
		set .@safe,4;
		break;
	case 1: 	//Refine Level 1 Weapon
		set .@price,50;
		set .@material,1010; //Phracon
		set .@safe,7;
		break;
	case 2: 	//Refine Level 2 Weapon
		set .@price,200;
		set .@material,1011; //Emveretarcon
		set .@safe,6;
		break;
	case 3: 	//Refine Level 3 Weapon
		set .@price,5000;
		set .@material,984; //Oridecon
		set .@safe,5;
		break;
	case 4: 	//Refine Level 4 Weapon
		set .@price,20000;
		set .@material,984; //Oridecon
		set .@safe,4;
		break;
	case 5: 	//Refine other stuff?
		set .@price,2000;
		set .@material,985; //Elunium
		set .@safe,4;
		break;
	}

	// If the VIP system is enabled, the prices for non-VIP players are considerably higher.
	if (VIP_SCRIPT && !vip_status(1)) {
		switch(getequipweaponlv(.@part)) {
			case 0: set .@price, .@price * 10; break;
			case 1: set .@price, .@price * 40; break;
			case 2: set .@price, .@price * 50; break;
			case 3: set .@price, .@price * 2; break;
			case 4: set .@price, .@price * 2; break;
			case 5: set .@price, .@price * 10; break;
		}
	}

	if(.@features != 1) {
		mes "["+ .@npc_name$ +"]";
		mes "To refine this I need";
		mes "one ^003366"+getitemname(.@material)+"^000000 and";
		mes "a service fee of " + .@price + " Zeny.";
		mes "Do you really wish to continue?";
		next;
		if(select("Yes:No") == 2){
			mes "["+ .@npc_name$ +"]";
			mes "Yeah...";
			mes "There's no need to";
			mes "rush. Take your time.";
			close;
		}
		if(getequippercentrefinery(.@part) < 100) {
			mes "["+ .@npc_name$ +"]";
			mes "Oh no! If I continue to";
			mes "refine this, there's a risk it could";
			switch(.@material) {
			case 985:
				mes "be destroyed! That means that ^FF0000this equipment^000000, and ^FF0000any cards^000000 or special properties added to this armor, ^FF0000will be gone^000000.";
				break;
			default:
				mes "be destroyed, and you'd ^FF0000lose the weapon^000000, any ^FF0000cards in the weapon^000000,";
				mes "or any added special properties.";
				break;
			}
			next;
			mes "["+getarg(0)+"]";
			mes "I can't make it any clearer.";
			mes "Once a weapon is destroyed,";
			mes "there's no getting it back.";
			mes "You really have a chance to";
			mes "^FF0000lose this weapon^000000 forever.";
			mes "Do you still want to refine?";
			next;
			if(select("Yes:No") == 2){
				mes "["+ .@npc_name$ +"]";
				mes "I completely agree...";
				mes "I might be a great refiner, but sometimes even I make mistakes.";
				close;
			}
		}
		if((countitem(.@material) < 1) || (Zeny < .@price)) {
			mes "["+ .@npc_name$ +"]";
			mes "You don't seem to have";
			mes "enough Zeny or "+getitemname(.@material)+"...";
			mes "Go get some more. I'll be";
			mes "here all day if you need me.";
			close;
		}
		set Zeny, Zeny-.@price;
		delitem .@material,1;

		// anti-hack
		if (callfunc("F_IsEquipIDHack", .@part, .@refineitemid) ||
		    callfunc("F_IsEquipRefineHack", .@part, .@refinerycnt)) {
			mes "["+ .@npc_name$ +"]";
			emotion e_an;
			mes "Wait a second...";
			mes "Do you think I'm stupid?!";
			mes "You switched the item while I wasn't looking! Get out of here!";
			close;
		}

		if(getequippercentrefinery(.@part) <= rand(100)) {
			failedrefitem .@part;
			mes "["+ .@npc_name$ +"]";
			emotion (!rand(5))?e_cash:e_omg;
			set .@lose,rand(1,3);
			if (.@lose == 1) {
				mes "OH! MY GOD!";
				mes "Damn it! Not again!";
				mes "I'm terribly sorry, but you know practice does make perfect.";
				mes "Um, right? Heh heh...";
			} else if(.@lose == 2) {
				mes "Nooooooo!";
				mes "It broke!";
				mes "I-I'm sorry!";
			} else {
				mes "Crap!";
				mes "It couldn't take";
				mes "much more tempering!";
				mes "Sorry about this...";
			}
			close;
		}
		mes "["+getarg(0)+"]";
		successrefitem .@part;
		emotion e_heh;
		set .@win,rand(1,3);
		if (.@win == 1) {
			mes "Perfect!";
			mes "Heh heh!";
			mes "Once again,";
			mes "flawless work";
			mes "from the master~";
		} else if(.@win == 2) {
			mes "Success...!";
			mes "Yet again, my amazing";
			mes "talent truly dazzles";
			mes "and shines today.";
		} else {
			mes "Heh heh!";
			mes "I'm all done.";
			mes "No doubt, my work is";
			mes "to your satisfaction.";
			mes "Sheer, utter perfection~";
		}
		close;
	}

// New Refining Functions ========================
	if(getequiprefinerycnt(.@part) < .@safe) {
		mes "["+ .@npc_name$ +"]";
		mes "I can refine this to the safe limit or a desired number of times. It's your choice.";
		next;
		set .@menu2,select("To the safe limit, please.","I'll decide how many times.","I've changed my mind...");
	} else
		set .@menu2,2;
	switch(.@menu2){
	case 1: 
		set .@refinecnt,.@safe - getequiprefinerycnt(.@part);
		break;
	case 2:
		next;
		mes "["+ .@npc_name$ +"]";
		mes "How many times would you like me to refine your item?";
		next;
		input .@refinecnt;
		set .@refinecheck,.@refinecnt + getequiprefinerycnt(.@part);
		if (.@refinecnt < 1 || .@refinecheck > 10) {
			mes "["+ .@npc_name$ +"]";
			mes "I can't refine this item that many times.";
			close;
		}
		if(.@refinecheck > .@safe) {
			set .@refinecheck,.@refinecheck - .@safe;
			mes "["+ .@npc_name$ +"]";
			mes "This will try to refine the equipment " + .@refinecheck + " times past the safe limit. Your equipment may be destroyed... is that ok?";
			next;
			if(select("Yes...","No...") == 2){
				mes "["+ .@npc_name$ +"]";
				mes "You said so... So be it.";
				close;
			}
		}
		break;
	case 3:
		next;
		mes "["+ .@npc_name$ +"]";
		mes "You said so... So be it.";
		close;
	}
	set .@fullprice,.@price * .@refinecnt;
	mes "["+ .@npc_name$ +"]";
	mes "That will cost you " + .@refinecnt + " " + getitemname(.@material) + " and " + .@fullprice + " Zeny. Is that ok?";
	next;
	if(select("Yes","No...") == 2){
		mes "["+ .@npc_name$ +"]";
		mes "You said so... So be it.";
		close;
	}
	if(countitem(.@material) < .@refinecnt || Zeny < .@fullprice) {
		mes "["+ .@npc_name$ +"]";
		mes "Is that all you got? Unfortunately I can't work for you at a lower price. Try putting yourself in my shoes.";
		close;
	}
	set Zeny, Zeny - .@fullprice;
	delitem .@material,.@refinecnt;
	while(.@refinecnt){
		if (getequipisequiped(.@part) == 0) {
			mes "["+ .@npc_name$ +"]";
			mes "Look here... you don't have any items on...";
			close;
		}
		if (getequipid(.@part) != .@refineitemid || (.@menu2 == 1 && getequippercentrefinery(.@part) < 100)) {
			mes "["+ .@npc_name$ +"]";
			mes "Clang... No, but did you imagine I could be so stupid?!";
			mes "You changed it...";
			mes "Get out before I stun you with my Hammer!!";
			close;
		} 
		mes "Clang, clang!!!";
		if(.@menu2 == 2 && getequippercentrefinery(.@part) <= rand(100)) {
			failedrefitem .@part;
			emotion e_omg;
			mes "["+ .@npc_name$ +"]";
			mes "WAHHHH!!! I'm so sorry... I warned you this could happen...";
			set .@refinecnt,.@refinecnt - 1;
			if(.@refinecnt == 0) close;
			mes "Here's the unused Zeny and materials back...";
			getitem .@material,.@refinecnt;
			set .@fullprice,.@refinecnt * .@price;
			set Zeny, Zeny + .@fullprice;
			close;
		}
		successrefitem .@part;
		emotion e_no1;
		set .@refinecnt,.@refinecnt - 1;
		next;
	}
	mes "["+ .@npc_name$ +"]";
	mes "All finished... Come again soon.";
	close;

 

Edited by Sindit
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  38
  • Reputation:   0
  • Joined:  03/26/16
  • Last Seen:  

Still the same sir .. I also found out that its not just with the refiner npc but also with the card remover npc and also when compounding a card in an item ... I'm wondering if it has something to do with the src ... Please help

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  22
  • Reputation:   11
  • Joined:  07/16/17
  • Last Seen:  

No, it's nothing wrong with your src.

Btw, here's your code fixed and tested:

// Weapon/Armor Refiners
//============================================================
prt_in,63,60,0	script	Hollgrehenn	85,{
	callfunc "refinemain","Hollgrehenn",0;
	end;
}
morocc_in,73,38,6	script	Aragham	99,{
	callfunc "refinemain","Aragham",0;
	end;
}
payon,144,173,5	script	Antonio	88,{
	callfunc "refinemain","Antonio",0;
	end;
}
alberta_in,28,58,0	script	Fredrik	85,{
	callfunc "refinemain","Fredrik",0;
	end;
}
yuno_in01,171,21,4	script	Lambert	88,{
	callfunc "refinemain","Lambert",0;
	end;
}
ein_in01,24,87,5	script	Manthasman	826,{
	callfunc "refinemain","Manthasman Pruhag",0;
	end;
}
lhz_in02,282,20,7	script	Fulerr	869,{
	callfunc "refinemain","Fulerr",0;
	end;
}

//============================================================
//= Main Refiner Function
//============================================================
//= To allow auto safe refining/multiple refining set the
//= second argument to '1' in the function call.
//= If you enable this function, be sure to edit the value of
//= .@safe to the max safe refine in refine_db.txt as well.
//============================================================
function	script	refinemain	{
	disable_items;
	.@npc_name$ = getarg(0);
	set .@features,getarg(1);
	mes "["+ .@npc_name$ +"]";
	mes "I'm the Armsmith.";
	mes "I can refine all kinds of weapons, armor and equipment, so let me";
	mes "know what you want me to refine.";
	next;
	setarray .@equip_pos[1], EQI_HEAD_TOP, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, EQI_GARMENT, EQI_SHOES, EQI_ACC_R, EQI_ACC_L, EQI_HEAD_MID, EQI_HEAD_LOW;
	setarray .@position$[1], "Head", "Body", "Left hand", "Right hand", "Robe", "Shoes", "Accessory 1", "Accessory 2", "Head 2", "Head 3";
	for(.@i = 1; .@i <= getarraysize(.@position$); .@i++) {
		if(getequipisequiped(.@equip_pos[.@i])) {
			.@menu$ += .@position$[.@i] + "-" + "[" + getequipname(.@equip_pos[.@i]) + "]";
			.@equipped = 1;
		}
		set .@menu$, .@menu$ + ":";
	}
	.@select = select(.@menu$);	
	.@part = .@equip_pos[.@select];
	if (.@equipped == 0) {
		mes "["+ .@npc_name$ +"]";
		mes "I don't think I can refine any items you have...";
		close;
	}
	if(!getequipisequiped(.@part)) { //custom check
		mes "["+ .@npc_name$ +"]";
		mes "You're not wearing";
		mes "anything there that";
		mes "I can refine.";
		emotion e_an;
		close;
	}
	//Check if the item is refinable...
	if(!getequipisenableref(.@part)) {
		mes "["+ .@npc_name$ +"]";
		mes "I don't think I can";
		mes "refine this item at all...";
		close;
	}
	//Check to see if the items is already +10
	if(getequiprefinerycnt(.@part) >= 10) {
		mes "["+ .@npc_name$ +"]";
		mes "I can't refine this";
		mes "any more. This is as";
		mes "refined as it gets!";
		close;
	}
	set .@refineitemid, getequipid(.@part); // save id of the item
	set .@refinerycnt, getequiprefinerycnt(.@part); //save refinery count
	switch(getequipweaponlv(.@part)){
	case 0: 	//Refine Armor
		set .@price,2000;
		set .@material,985; //Elunium
		set .@safe,4;
		break;
	case 1: 	//Refine Level 1 Weapon
		set .@price,50;
		set .@material,1010; //Phracon
		set .@safe,7;
		break;
	case 2: 	//Refine Level 2 Weapon
		set .@price,200;
		set .@material,1011; //Emveretarcon
		set .@safe,6;
		break;
	case 3: 	//Refine Level 3 Weapon
		set .@price,5000;
		set .@material,984; //Oridecon
		set .@safe,5;
		break;
	case 4: 	//Refine Level 4 Weapon
		set .@price,20000;
		set .@material,984; //Oridecon
		set .@safe,4;
		break;
	case 5: 	//Refine other stuff?
		set .@price,2000;
		set .@material,985; //Elunium
		set .@safe,4;
		break;
	}

	// If the VIP system is enabled, the prices for non-VIP players are considerably higher.
	if (VIP_SCRIPT && !vip_status(1)) {
		switch(getequipweaponlv(.@part)) {
			case 0: set .@price, .@price * 10; break;
			case 1: set .@price, .@price * 40; break;
			case 2: set .@price, .@price * 50; break;
			case 3: set .@price, .@price * 2; break;
			case 4: set .@price, .@price * 2; break;
			case 5: set .@price, .@price * 10; break;
		}
	}

	if(.@features != 1) {
		mes "["+ .@npc_name$ +"]";
		mes "To refine this I need";
		mes "one ^003366"+getitemname(.@material)+"^000000 and";
		mes "a service fee of " + .@price + " Zeny.";
		mes "Do you really wish to continue?";
		next;
		if(select("Yes:No") == 2){
			mes "["+ .@npc_name$ +"]";
			mes "Yeah...";
			mes "There's no need to";
			mes "rush. Take your time.";
			close;
		}
		if(getequippercentrefinery(.@part) < 100) {
			mes "["+ .@npc_name$ +"]";
			mes "Oh no! If I continue to";
			mes "refine this, there's a risk it could";
			switch(.@material) {
			case 985:
				mes "be destroyed! That means that ^FF0000this equipment^000000, and ^FF0000any cards^000000 or special properties added to this armor, ^FF0000will be gone^000000.";
				break;
			default:
				mes "be destroyed, and you'd ^FF0000lose the weapon^000000, any ^FF0000cards in the weapon^000000,";
				mes "or any added special properties.";
				break;
			}
			next;
			mes "["+getarg(0)+"]";
			mes "I can't make it any clearer.";
			mes "Once a weapon is destroyed,";
			mes "there's no getting it back.";
			mes "You really have a chance to";
			mes "^FF0000lose this weapon^000000 forever.";
			mes "Do you still want to refine?";
			next;
			if(select("Yes:No") == 2){
				mes "["+ .@npc_name$ +"]";
				mes "I completely agree...";
				mes "I might be a great refiner, but sometimes even I make mistakes.";
				close;
			}
		}
		if((countitem(.@material) < 1) || (Zeny < .@price)) {
			mes "["+ .@npc_name$ +"]";
			mes "You don't seem to have";
			mes "enough Zeny or "+getitemname(.@material)+"...";
			mes "Go get some more. I'll be";
			mes "here all day if you need me.";
			close;
		}
		set Zeny, Zeny-.@price;
		delitem .@material,1;

		// anti-hack
		if (callfunc("F_IsEquipIDHack", .@part, .@refineitemid) ||
		    callfunc("F_IsEquipRefineHack", .@part, .@refinerycnt)) {
			mes "["+ .@npc_name$ +"]";
			emotion e_an;
			mes "Wait a second...";
			mes "Do you think I'm stupid?!";
			mes "You switched the item while I wasn't looking! Get out of here!";
			close;
		}

		if(getequippercentrefinery(.@part) <= rand(100)) {
			failedrefitem .@part;
			mes "["+ .@npc_name$ +"]";
			emotion (!rand(5))?e_cash:e_omg;
			set .@lose,rand(1,3);
			if (.@lose == 1) {
				mes "OH! MY GOD!";
				mes "Damn it! Not again!";
				mes "I'm terribly sorry, but you know practice does make perfect.";
				mes "Um, right? Heh heh...";
			} else if(.@lose == 2) {
				mes "Nooooooo!";
				mes "It broke!";
				mes "I-I'm sorry!";
			} else {
				mes "Crap!";
				mes "It couldn't take";
				mes "much more tempering!";
				mes "Sorry about this...";
			}
			close;
		}
		mes "["+getarg(0)+"]";
		successrefitem .@part;
		emotion e_heh;
		set .@win,rand(1,3);
		if (.@win == 1) {
			mes "Perfect!";
			mes "Heh heh!";
			mes "Once again,";
			mes "flawless work";
			mes "from the master~";
		} else if(.@win == 2) {
			mes "Success...!";
			mes "Yet again, my amazing";
			mes "talent truly dazzles";
			mes "and shines today.";
		} else {
			mes "Heh heh!";
			mes "I'm all done.";
			mes "No doubt, my work is";
			mes "to your satisfaction.";
			mes "Sheer, utter perfection~";
		}
		close;
	}

// New Refining Functions ========================
	if(getequiprefinerycnt(.@part) < .@safe) {
		mes "["+ .@npc_name$ +"]";
		mes "I can refine this to the safe limit or a desired number of times. It's your choice.";
		next;
		set .@menu2,select("To the safe limit, please.","I'll decide how many times.","I've changed my mind...");
	} else
		set .@menu2,2;
	switch(.@menu2){
	case 1: 
		set .@refinecnt,.@safe - getequiprefinerycnt(.@part);
		break;
	case 2:
		next;
		mes "["+ .@npc_name$ +"]";
		mes "How many times would you like me to refine your item?";
		next;
		input .@refinecnt;
		set .@refinecheck,.@refinecnt + getequiprefinerycnt(.@part);
		if (.@refinecnt < 1 || .@refinecheck > 10) {
			mes "["+ .@npc_name$ +"]";
			mes "I can't refine this item that many times.";
			close;
		}
		if(.@refinecheck > .@safe) {
			set .@refinecheck,.@refinecheck - .@safe;
			mes "["+ .@npc_name$ +"]";
			mes "This will try to refine the equipment " + .@refinecheck + " times past the safe limit. Your equipment may be destroyed... is that ok?";
			next;
			if(select("Yes...","No...") == 2){
				mes "["+ .@npc_name$ +"]";
				mes "You said so... So be it.";
				close;
			}
		}
		break;
	case 3:
		next;
		mes "["+ .@npc_name$ +"]";
		mes "You said so... So be it.";
		close;
	}
	set .@fullprice,.@price * .@refinecnt;
	mes "["+ .@npc_name$ +"]";
	mes "That will cost you " + .@refinecnt + " " + getitemname(.@material) + " and " + .@fullprice + " Zeny. Is that ok?";
	next;
	if(select("Yes","No...") == 2){
		mes "["+ .@npc_name$ +"]";
		mes "You said so... So be it.";
		close;
	}
	if(countitem(.@material) < .@refinecnt || Zeny < .@fullprice) {
		mes "["+ .@npc_name$ +"]";
		mes "Is that all you got? Unfortunately I can't work for you at a lower price. Try putting yourself in my shoes.";
		close;
	}
	set Zeny, Zeny - .@fullprice;
	delitem .@material,.@refinecnt;
	while(.@refinecnt){
		if (getequipisequiped(.@part) == 0) {
			mes "["+ .@npc_name$ +"]";
			mes "Look here... you don't have any items on...";
			close;
		}
		if (getequipid(.@part) != .@refineitemid || (.@menu2 == 1 && getequippercentrefinery(.@part) < 100)) {
			mes "["+ .@npc_name$ +"]";
			mes "Clang... No, but did you imagine I could be so stupid?!";
			mes "You changed it...";
			mes "Get out before I stun you with my Hammer!!";
			close;
		} 
		mes "Clang, clang!!!";
		if(.@menu2 == 2 && getequippercentrefinery(.@part) <= rand(100)) {
			failedrefitem .@part;
			emotion e_omg;
			mes "["+ .@npc_name$ +"]";
			mes "WAHHHH!!! I'm so sorry... I warned you this could happen...";
			set .@refinecnt,.@refinecnt - 1;
			if(.@refinecnt == 0) close;
			mes "Here's the unused Zeny and materials back...";
			getitem .@material,.@refinecnt;
			set .@fullprice,.@refinecnt * .@price;
			set Zeny, Zeny + .@fullprice;
			close;
		}
		successrefitem .@part;
		emotion e_no1;
		set .@refinecnt,.@refinecnt - 1;
		next;
	}
	mes "["+ .@npc_name$ +"]";
	mes "All finished... Come again soon.";
	close;
}

 

Remember: This code is testing if the equipment already has an equal or higher refine than 10. And if that condition are true, the refiner will stop dialog (lines 81-87).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...