Jump to content
  • 0

Weapon refine break rate


Question

Posted

Hi, 

How can I lower the chances of breaking the item when using Weapon Refine by whitesmith.

void skill_weaponrefine(struct map_session_data *sd, int idx)
{
	nullpo_retv(sd);

	if (idx >= 0 && idx < MAX_INVENTORY)
	{
		struct item *item;
		struct item_data *ditem = sd->inventory_data[idx];
		item = &sd->inventory.u.items_inventory[idx];

		if(item->nameid > 0 && ditem->type == IT_WEAPON) {
			int i = 0, per;
			unsigned short material[5] = { 0, ITEMID_PHRACON, ITEMID_EMVERETARCON, ITEMID_ORIDECON, ITEMID_ORIDECON };
			if( ditem->flag.no_refine ) { 	// if the item isn't refinable
				clif_skill_fail(sd,sd->menuskill_id,USESKILL_FAIL_LEVEL,0);
				return;
			}
			if( item->refine >= sd->menuskill_val || item->refine >= 10 ) {
				clif_upgrademessage(sd->fd, 2, item->nameid);
				return;
			}
			if( (i = pc_search_inventory(sd, material [ditem->wlv])) < 0 ) {
				clif_upgrademessage(sd->fd, 3, material[ditem->wlv]);
				return;
			}
			per = status_get_refine_chance(static_cast<refine_type>(ditem->wlv), (int)item->refine, false);
			if( sd->class_&JOBL_THIRD )
				per += 15;
			else
				per += (((signed int)sd->status.job_level)-50)/2; //Updated per the new kro descriptions. [Skotlex]

			pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
			if (per > rnd() % 100) {
				int ep=0;
				log_pick_pc(sd, LOG_TYPE_OTHER, -1, item);
				item->refine++;
				log_pick_pc(sd, LOG_TYPE_OTHER,  1, item);
				if(item->equip) {
					ep = item->equip;
					pc_unequipitem(sd,idx,3);
				}
				clif_delitem(sd,idx,1,3);
				clif_upgrademessage(sd->fd, 0, item->nameid);
				clif_inventorylist(sd);
				clif_refine(sd->fd,0,idx,item->refine);
				achievement_update_objective(sd, AG_REFINE_SUCCESS, 2, ditem->wlv, item->refine);
				if (ep)
					pc_equipitem(sd,idx,ep);
				clif_misceffect(&sd->bl,3);
				if(item->refine == 10 &&
					item->card[0] == CARD0_FORGE &&
					(int)MakeDWord(item->card[2],item->card[3]) == sd->status.char_id)
				{ // Fame point system [DracoRPG]
					switch(ditem->wlv){
						case 1:
							pc_addfame(sd, battle_config.fame_refine_lv1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point
							break;
						case 2:
							pc_addfame(sd, battle_config.fame_refine_lv2); // Success to refine to +10 a lv2 weapon you forged = +25 fame point
							break;
						case 3:
							pc_addfame(sd, battle_config.fame_refine_lv3); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point
							break;
					}
				}
			} else {
				item->refine = 0;
				if(item->equip)
					pc_unequipitem(sd,idx,3);
				clif_upgrademessage(sd->fd, 1, item->nameid);
				clif_refine(sd->fd,1,idx,item->refine);
				achievement_update_objective(sd, AG_REFINE_FAIL, 1, 1);
				pc_delitem(sd,idx,1,0,2, LOG_TYPE_OTHER);
				clif_misceffect(&sd->bl,2);
				clif_emotion(&sd->bl, ET_HUK);
			}
		}
	}
}

Thanks

6 answers to this question

Recommended Posts

  • 0
Posted

As far as I could dig into it, all refine chances on source are read directly from the refine_db.

This fragment:

			if( sd->class_&JOBL_THIRD )
				per += 15;
			else
				per += (((signed int)sd->status.job_level)-50)/2; //Updated per the new kro descriptions. [Skotlex]

Adds a modifier on top of it depending on the class, +15% in absolute for Third Classes (which probably just means Mechanic) and (Joblevel - 50)/2 for the Black/Whitesmith.
Blackmisths can't go over Level 50, so, it wouldn't add anything, but Whitesmiths can get, it seems, up to 10% extra. ((70 - 50)/2)

  • 0
Posted
1 hour ago, pajodex said:

Thanks @Haziel that's good to know. I guess to lower the break chance is almost impossible to set. 

You just add a new condition or alter the formula here:
 

per += (((signed int)sd->status.job_level)-50)/2; //Updated per the new kro descriptions. [Skotlex]

That's specifically where it sets the modifier for the Whitesmith.

  • 0
Posted
2 hours ago, Haziel said:

You just add a new condition or alter the formula here:
 


per += (((signed int)sd->status.job_level)-50)/2; //Updated per the new kro descriptions. [Skotlex]

That's specifically where it sets the modifier for the Whitesmith.

Yeah but basing on that code, it only adjusts the "success rate". I wanted to alter the "break rate" and make the success rate as is. As I read the code:

 

16 hours ago, pajodex said:

item->refine = 0; if(item->equip) pc_unequipitem(sd,idx,3); clif_upgrademessage(sd->fd, 1, item->nameid);

I guess it breaks when it won't refine but nothing says about the breaking rate chances 

  • 0
Posted
21 hours ago, Haziel said:

Success and break rates are connected, if it fails, it will breaks.
So, incresing success is decreasing breaking chance.

I understand that. But if that is the case, then it is nearly impossible to adjust the breaking chance alone. /heh 

If I increase the success rate, ppl might not use the refiner ever again /heh

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