Jump to content
  • 0

Requesting Refiner (Specific Items)


Question

Posted

Hello, i know this is really common questions asking for Refiner something like this but first i tried to search via forum but i couldn't find any exact what i want.
So my request is an NPC refines a specific ITEMS ONLY.
Example:

	setarray .@equip_loc[0],EQI_HAND_L, EQI_HAND_R;
	setarray .@item_id[0], 1201, 1202, 1203;
	.@item_req_id = 512;

Each refine cost is x 1 the higher refinement the higher is cost example: + 4 and your going to upgrade for + 5 you need to pay x5 too.
Thank you!

1 answer to this question

Recommended Posts

  • 0
Posted (edited)

try this

i used rAthena refiner as a base , as you didn't provide any npc

prontera,0,0,0	script	refiner	444,{
	.@npc_name$ = "refiner";
	setarray .@indices[1], EQI_HEAD_TOP, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, EQI_GARMENT, EQI_SHOES, EQI_ACC_L, EQI_ACC_R, EQI_HEAD_MID, EQI_HEAD_LOW;
	for(.@i = 1; .@i<getarraysize(.@indices); ++.@i) {
		if(getequipisequiped(.@indices[.@i])) {
			.@menu$ = .@menu$ + F_getpositionname(.@indices[.@i]) + "-[" + getequipname(.@indices[.@i]) + "]";
			.@equipped = 1;
		}
		.@menu$ = .@menu$ + ":";
	}
	if (.@equipped == 0) {
		mes "["+ .@npc_name$ +"]";
		mes "I don't think I can refine any items you have...";
		close;
	}
	.@part = .@indices[select(.@menu$)];

	if(!getequipisequiped(.@part)) { //custom check
		mes "["+ .@npc_name$ +"]";
		mes "You're not wearing";
		mes "anything there that";
		mes "I can refine.";
		emotion ET_FRET;
		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;
	}
	.@refineitemid = getequipid(.@part); // save id of the item
	.@refinerycnt = getequiprefinerycnt(.@part); //save refinery count
	setarray .@card[0], getequipcardid(.@part,0), getequipcardid(.@part,1), getequipcardid(.@part,2), getequipcardid(.@part,3);
	.@price = getequiprefinecost(.@part, REFINE_COST_NORMAL, REFINE_ZENY_COST);
	.@material = getequiprefinecost(.@part, REFINE_COST_NORMAL, REFINE_MATERIAL_ID);
	
	//editing here
	.@materialCount = getequiprefinerycnt(.@part) +1;
	if(inarray(.allowed_items,.@refineitemid) == -1){
		mes "sorry, i can't refine " + getitemname(.@refineitemid);
		end;
	}

	switch (getequipweaponlv(.@part)) {
		case 1: .@safe = 7; break;
		case 2: .@safe = 6; break;
		case 3: .@safe = 5; break;
		case 4:
		default: .@safe = 4; break;
	}

	mes "["+ .@npc_name$ +"]";
	mes "To refine this I need";
	mes .@materialCount + " ^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 "["+ .@npc_name$ +"]";
		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) < .@materialCount) || (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;
	}
	Zeny = Zeny-.@price;
	delitem .@material,.@materialCount;

	// anti-hack
	if (callfunc("F_IsEquipIDHack", .@part, .@refineitemid) || callfunc("F_IsEquipCardHack", .@part, .@card[0], .@card[1], .@card[2], .@card[3]) ||
	    callfunc("F_IsEquipRefineHack", .@part, .@refinerycnt)) {
		mes "["+ .@npc_name$ +"]";
		emotion ET_FRET;
		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))?ET_MONEY:ET_HUK;
		.@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 ET_SMILE;
	.@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;

OnInit:
	serattay .allowed_items,1201, 1202, 1203;
end;
}

 

Edited by sader1992

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...