Skip to content

Commit

Permalink
Modified successrefitem script command
Browse files Browse the repository at this point in the history
Added a new optional parameter to specify upgrade quantity, so its consistent with downrefitem which provides a optional parameter to specify downgrade quantity.
As proposed by kyeme in
http://hercules.ws/board/topic/2403-successrefitem/

Signed-off-by: shennetsind <ind@henn.et>
  • Loading branch information
shennetsind committed Feb 10, 2014
1 parent cd8d093 commit 9d1f80e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
12 changes: 4 additions & 8 deletions doc/script_commands.txt
Expand Up @@ -4939,21 +4939,17 @@ the command will end silently.

---------------------------------------

*successrefitem <equipment slot>;
*successrefitem <equipment slot>{,<upgrade_count>};

This command will refine an item in the specified equipment slot of the
invoking character by +1. For a list of equipment slots see 'getequipid'.
This command will not only add the +1, but also display a 'refine success'
invoking character by +1 (unless <upgrade_count> is specified).
For a list of equipment slots see 'getequipid'.
This command will also display a 'refine success'
effect on the character and put appropriate messages into their chat
window. It will also give the character fame points if a weapon reached
+10 this way, even though these will only take effect for blacksmith who
will later forge a weapon.

The official scripts seems to use the 'successrefitem' command as a
function instead: 'successrefitem(<number>)' but it returns nothing on the
stack. This is since jAthena, so probably nobody knows for sure why is it
so.

---------------------------------------

*failedrefitem <equipment slot>;
Expand Down
13 changes: 8 additions & 5 deletions src/map/script.c
Expand Up @@ -7666,16 +7666,18 @@ BUILDIN(getequippercentrefinery) {
/*==========================================
* Refine +1 item at pos and log and display refine
*------------------------------------------*/
BUILDIN(successrefitem)
{
int i=-1,num,ep;
BUILDIN(successrefitem) {
int i = -1 , num, ep, up = 1;
TBL_PC *sd;

num = script_getnum(st,2);
sd = script->rid2sd(st);
if( sd == NULL )
return true;

if( script_hasdata(st, 3) )
up = script_getnum(st, 3);

if (num > 0 && num <= ARRAYLENGTH(script->equip))
i=pc->checkequip(sd,script->equip[num-1]);
if(i >= 0) {
Expand All @@ -7687,7 +7689,8 @@ BUILDIN(successrefitem)
if (sd->status.inventory[i].refine >= MAX_REFINE)
return true;

sd->status.inventory[i].refine++;
sd->status.inventory[i].refine += up;
sd->status.inventory[i].refine = cap_value( sd->status.inventory[i].refine, 0, MAX_REFINE);
pc->unequipitem(sd,i,2); // status calc will happen in pc->equipitem() below

clif->refine(sd->fd,0,i,sd->status.inventory[i].refine);
Expand Down Expand Up @@ -18580,7 +18583,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(getequiprefinerycnt,"i"),
BUILDIN_DEF(getequipweaponlv,"i"),
BUILDIN_DEF(getequippercentrefinery,"i"),
BUILDIN_DEF(successrefitem,"i"),
BUILDIN_DEF(successrefitem,"i?"),
BUILDIN_DEF(failedrefitem,"i"),
BUILDIN_DEF(downrefitem,"i?"),
BUILDIN_DEF(statusup,"i"),
Expand Down

0 comments on commit 9d1f80e

Please sign in to comment.