Jump to content
  • 0

Need help for custom refiner


Yaziid91

Question


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  66
  • Reputation:   0
  • Joined:  04/20/19
  • Last Seen:  

Hello everyone, I need help creating an NPC. I would like a refiner who, with item 501, refines ID 1001 by +1 with a 100% success rate, and with item 503, refines ID 1002 by +1 with a 100% success rate. Additionally, I want items with IDs 1001 and 1002 to not be refinable by the official NPC (elunium).

Thanks for you help.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  212
  • Reputation:   94
  • Joined:  06/02/12
  • Last Seen:  

Hello. Try to understand the code. Feel free to ask about what you don't understand.

//===== Script for rAthena by Racaae =========================
//= https://rathena.org/board/topic/142576-need-help-for-custom-refiner/
//===== Additional Comments: ================================= 
//= Modified from Euphy' Ticket Refiner
//============================================================ 

prontera,160,160,3	script	Custom Refiner	4_F_MORAFINE2,{

	setarray .@list,
			//RefineCost, MaxRefine, RefinableEquip,
 				501, 10, 1001,
 				503, 10, 1002;

	disable_items;
	
	// Greetings
	mes "[Custom Refiner]";
	mes "Hello! What's up?";
	mes "I'm a refiner for specific items using specific catalysts.";
	mes "You don't have to worry! It's by +1 with a ^006400100% success rate^000000.";
	next;
	if(select("Which items do you refine?", "Refine") == 1) {
		mes "[Custom Refiner]";
		mes "I can refine the following:";
		for ( .@i = 0; .@i < getarraysize(.@list); .@i += 3 ) {
			mes "- [" + mesitemlink(.@list[.@i+2], false) + "] using";
			mes "[" + mesitemlink(.@list[.@i], false) + "] up to +" + .@list[.@i+1] + ".";
		}
		if (.@i = getarraysize(.@list))
			close;
		if (!.@i%3) {
			next;
			mes "[Custom Refiner]";
		}
	}
	mes "[Custom Refiner]";
	mes "Which equipment would you like to refine?";
	
	//Use a array to store and show equips the player is using
	setarray .@position$[1],"Head upper","Armor","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head middle","Head lower";
	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 <= 10; ++.@i )
		.@menu$ += (getequipisequiped(.@indices[.@i]) ? getequipname(.@indices[.@i]) : .@position$[.@i] + "- [Empty]") + ":";

	
	//Saves which equipment the player chose
	.@part = .@indices[ select(.@menu$) ];
	clear;
	if (!getequipisequiped(.@part)) {
		mes "[Custom Refiner]";
		mes "You have to equip the item you want to refine.";
		close;
	}

	//Find player's equipment in the list of refinable options.
	for ( .@i = 2; .@i < getarraysize(.@list); .@i += 3 ) {
		if (getequipid(.@part) == .@list[.@i]) {
			.@cost = .@list[.@i-2];
			.@max = .@list[.@i-1];
			break;
		}
	}
	if (!.@cost) {
		mes "[Custom Refiner]";
		mes "Oh, I'm sorry.";
		mes "This item is impossible for me to refine.";
		close;
	}
	.@refineitemid = getequipid(.@part); // save id of the item
	.@refinerycnt = getequiprefinerycnt(.@part); //save refinery count
	if (countitem(.@cost) == 0) {
		mes "[Custom Refiner]";
		mes "I need the [" + mesitemlink(.@cost, false) + "] to refine this item...";
		mes "See you later!";
		close;
	}
	if (getequiprefinerycnt(.@part) >= .@max) {
		mes "[Custom Refiner]";
		mes "^8B4513This item is already refined as much as your deed.^000000";
		close;
	}
	mes "[Custom Refiner]";
	mes "I'm going to refine your ^006400" + getequipname(.@part) + "^8B4513 using the " + mesitemlink(.@cost) + ".";
	mes "May I proceed?";
	next;
	if (select("No.", ":Yes.") == 1)
		close;
	if (countitem(.@cost) < 1) {
		mes "Error!";
		mes "Please report this.";
		close;
	}
	delitem .@cost,1;

	// anti-hack
	if (F_IsEquipIDHack(.@part, .@refineitemid) ||
		F_IsEquipRefineHack(.@part, .@refinerycnt)) {
		mes "[Custom Refiner]";
		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;
	}
	specialeffect EF_GANBANTEIN;
	specialeffect2 EF_PROVIDENCE;
	successrefitem .@part;
	mes "[Custom Refiner]";
	mes "Alright, here it is~";
	close;
}

 

Add this in \db\import\item_db.yml: (Remove the first line if your file already has Body:)

Body:
  - Id: 1001
    Refineable: false
  - Id: 1002
    Refineable: false

 

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...