Jump to content
Sephus

Introducing the Item Options System

Recommended Posts

Wouldn't be

 

setequipoption(<equip_index>,<opt_index>,<slot>,<value>);

 

Instead of

 

setequipoption(<equip_index>,<slot>,<opt_index>,<value>);

 

?

 

The Item Option NPC released has the variables inverted in the method call too.

 

 

Also, I found a possible exploit:

Using the NPC to put options on an item, if you put an option the NPC will unequip the item, but if the item has options values already, the bonuses will stay with the character even without the equipment.

Removing the equipment manually removes the bonus, its just the "autoremove" from setequipoption that doesn't.

Edited by tedexx

Share this post


Link to post
Share on other sites

Wouldn't be

 

setequipoption(<equip_index>,<opt_index>,<slot>,<value>);

 

Instead of

 

setequipoption(<equip_index>,<slot>,<opt_index>,<value>);

 

?

 

The Item Option NPC released has the variables inverted in the method call too.

Yes, this will be fixed soon. The correct order is setequipoption(<equip_index>,<slot>,<opt_index>,<value>);

 

Edit: Fixed in the latest commit.

 

 

Also, I found a possible exploit:

Using the NPC to put options on an item, if you put an option the NPC will unequip the item, but if the item has options values already, the bonuses will stay with the character even without the equipment.

Removing the equipment manually removes the bonus, its just the "autoremove" from setequipoption that doesn't.

Addressed in PR#1673 Thank you for the report.

Share this post


Link to post
Share on other sites

OMG!! Finally an official system to do what I've created through script. Hmm, may pop back in just to release something using this in the future.

Share this post


Link to post
Share on other sites
AWESOME ADDITION!!!
 
 
I'm trying to add a custom option
 
[EnumVAR.VAR_CUSTOMMAXHP[1]] = "Custom MaxHP +%d"
 
but an error comes up after starting the client
 
attempt to index field '?' (a nil value)
 
 
    [EnumVAR.MDAMAGE_SIZE_SMALL_TARGET[1]] = "Magical damage against Small size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_MIDIUM_TARGET[1]] = "Magical damage against Medium size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_LARGE_TARGET[1]] = "Magical damage against Large size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_SMALL_USER[1]] = "Magical resistance Small size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_MIDIUM_USER[1]] = "Magical resistance Medium size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_LARGE_USER[1]] = "Magical resistance Large size monster +%d%%",    [EnumVAR.VAR_CUSTOMMAXHP[1]] = "Custom MaxHP +%d",    [EnumVAR.EnumVAR_LAST[1]] = "END"}

 

Also, I don't see any command to remove specific item option.

Edited by jupeto

Share this post


Link to post
Share on other sites

 

 

    [EnumVAR.MDAMAGE_SIZE_SMALL_TARGET[1]] = "Magical damage against Small size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_MIDIUM_TARGET[1]] = "Magical damage against Medium size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_LARGE_TARGET[1]] = "Magical damage against Large size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_SMALL_USER[1]] = "Magical resistance Small size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_MIDIUM_USER[1]] = "Magical resistance Medium size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_LARGE_USER[1]] = "Magical resistance Large size monster +%d%%",    [EnumVAR.VAR_CUSTOMMAXHP[1]] = "Custom MaxHP +%d",    [EnumVAR.EnumVAR_LAST[1]] = "END"}
 

Also, I don't see any command to remove specific item option.

 

 

This would be *setequipoption(<equip_index>,<slot>,0,0);

Share this post


Link to post
Share on other sites

 

 

    [EnumVAR.MDAMAGE_SIZE_SMALL_TARGET[1]] = "Magical damage against Small size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_MIDIUM_TARGET[1]] = "Magical damage against Medium size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_LARGE_TARGET[1]] = "Magical damage against Large size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_SMALL_USER[1]] = "Magical resistance Small size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_MIDIUM_USER[1]] = "Magical resistance Medium size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_LARGE_USER[1]] = "Magical resistance Large size monster +%d%%",    [EnumVAR.VAR_CUSTOMMAXHP[1]] = "Custom MaxHP +%d",    [EnumVAR.EnumVAR_LAST[1]] = "END"}
 

Also, I don't see any command to remove specific item option.

 

This would be *setequipoption(<equip_index>,<slot>,0,0);

 

Already tried that but the console says

 

[Error]: buildin_setequipoption: Option index 0 does not exist!

Share this post


Link to post
Share on other sites

 

 

 

    [EnumVAR.MDAMAGE_SIZE_SMALL_TARGET[1]] = "Magical damage against Small size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_MIDIUM_TARGET[1]] = "Magical damage against Medium size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_LARGE_TARGET[1]] = "Magical damage against Large size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_SMALL_USER[1]] = "Magical resistance Small size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_MIDIUM_USER[1]] = "Magical resistance Medium size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_LARGE_USER[1]] = "Magical resistance Large size monster +%d%%",    [EnumVAR.VAR_CUSTOMMAXHP[1]] = "Custom MaxHP +%d",    [EnumVAR.EnumVAR_LAST[1]] = "END"}
 

Also, I don't see any command to remove specific item option.

 

This would be *setequipoption(<equip_index>,<slot>,0,0);

 

Already tried that but the console says

 

[Error]: buildin_setequipoption: Option index 0 does not exist!

Ah right, then there needs to be a script command for its removal.

Share this post


Link to post
Share on other sites

 

 

 

 

    [EnumVAR.MDAMAGE_SIZE_SMALL_TARGET[1]] = "Magical damage against Small size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_MIDIUM_TARGET[1]] = "Magical damage against Medium size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_LARGE_TARGET[1]] = "Magical damage against Large size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_SMALL_USER[1]] = "Magical resistance Small size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_MIDIUM_USER[1]] = "Magical resistance Medium size monster +%d%%",    [EnumVAR.MDAMAGE_SIZE_LARGE_USER[1]] = "Magical resistance Large size monster +%d%%",    [EnumVAR.VAR_CUSTOMMAXHP[1]] = "Custom MaxHP +%d",    [EnumVAR.EnumVAR_LAST[1]] = "END"}
 

Also, I don't see any command to remove specific item option.

 

This would be *setequipoption(<equip_index>,<slot>,0,0);

 

Already tried that but the console says

 

[Error]: buildin_setequipoption: Option index 0 does not exist!

Ah right, then there needs to be a script command for its removal.

Yah, hopefully :D I'm trying to create a new script command for that...

 

Also, can you please help me create a new set of options, both client and server side

 

[EDIT]

 

I successfully added a remove option command, still not sure if it's the best way to do it LOL... I managed to add, remove option with this...

 

ALSO... fixed the (I think a bug) where the equipment is not forcefully equipped to the character after calculating the new stats by storing the current equipped item id of the user in a variable (eid) and use that variable to force equip (pc->equipitem(sd, i, eid);) the item

 

/**
 * Remove an equipment's option value.
 * *removeequipoption(<equip_index>,<slot>);
 *
 * @param equip_index     as the inventory index of the equipment.
 * @param slot            as the slot of the item option (1 to MAX_ITEM_OPTIONS)
 * @return 0 on failure, 1 on success.
 */
BUILDIN(removeequipoption)
{
    int equip_index = script_getnum(st, 2);
    int slot = script_getnum(st, 3);
    int i = -1;
    int eid = 0;

    struct map_session_data *sd = script->rid2sd(st);

    if (sd == NULL) {
        script_pushint(st, 0);
        ShowError("buildin_removeequipoption: Player not attached!\n");
        return false;
    }

    if (slot <= 0 || slot > MAX_ITEM_OPTIONS) {
        script_pushint(st, 0);
        ShowError("buildin_removeequipoption: Invalid option index %d (Min: 1, Max: %d) provided.\n", slot, MAX_ITEM_OPTIONS);
        return false;
    }

    if (equip_index > 0 && equip_index <= ARRAYLENGTH(script->equip)) {
        if ((i = pc->checkequip(sd, script->equip[equip_index - 1])) == -1) {
            ShowError("buildin_setequipoptioninfo: No equipment is equipped in the given index %d.\n", equip_index);
            script_pushint(st, 0);
            return false;
        }
    } else {
        ShowError("buildin_removeequipoptioninfo: Invalid equipment index %d provided.\n", equip_index);
        script_pushint(st, 0);
        return false;
    }

    if (sd->status.inventory[i].nameid != 0) {
        
        eid = sd->status.inventory[i].equip; // Store the current equipped item id to a variable to use for equiping again after calculating new stats
        
        /* Add Option Index */
        sd->status.inventory[i].option[slot-1].index = 0;
        /* Add Option Value */
        sd->status.inventory[i].option[slot-1].value = 0;

        /* Unequip and simulate deletion of the item. */
        pc->unequipitem(sd, i, PCUNEQUIPITEM_FORCE); // status calc will happen in pc->equipitem() below
        clif->refine(sd->fd, 0, i, sd->status.inventory[i].refine); // notify client of a refine.
        clif->delitem(sd, i, 1, DELITEM_MATERIALCHANGE); // notify client to simulate item deletion.
        /* Log deletion of the item. */
        logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i],sd->inventory_data[i]);
        /* Equip and simulate addition of the item. */
        clif->additem(sd, i, 1, 0); // notify client to simulate item addition.
        /* Log addition of the item. */
        logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[i], sd->inventory_data[i]);
        pc->equipitem(sd, i, eid); // force equip the item at the original position.
        clif->misceffect(&sd->bl, 2); // show effect
    }

    script_pushint(st, 1);

    return true;

}


BUILDIN_DEF(removeequipoption, "ii"),
Edited by jupeto

Share this post


Link to post
Share on other sites
As you might imagine, Smoke is always involved in big, cool projects. I would like to congratulate you and thank you on behalf of the whole community.

 

However, I do not see so many great utilities in this ... I do not know if it is due to the difficulty of understanding the language, or because the text has not been clarified, but I have not really seen it. (Please do not get me wrong, I'm just curious)

 

Is this system official?

Is there any utility besides not having to create custom cards to give players bonuses?

 

I'm sorry I looked ignorant, but I'm just curious.

Share this post


Link to post
Share on other sites

 

As you might imagine, Smoke is always involved in big, cool projects. I would like to congratulate you and thank you on behalf of the whole community.
 
However, I do not see so many great utilities in this ... I do not know if it is due to the difficulty of understanding the language, or because the text has not been clarified, but I have not really seen it. (Please do not get me wrong, I'm just curious)
 
Is this system official?
Is there any utility besides not having to create custom cards to give players bonuses?
 
I'm sorry I looked ignorant, but I'm just curious.

 

i guess it is a different way of displaying flavor text and equipment bonuses

Share this post


Link to post
Share on other sites

 

As you might imagine, Smoke is always involved in big, cool projects. I would like to congratulate you and thank you on behalf of the whole community.
 
However, I do not see so many great utilities in this ... I do not know if it is due to the difficulty of understanding the language, or because the text has not been clarified, but I have not really seen it. (Please do not get me wrong, I'm just curious)
 
Is this system official?
Is there any utility besides not having to create custom cards to give players bonuses?
 
I'm sorry I looked ignorant, but I'm just curious.

 

This is an official system yes.

This doesn't have anything to do with creating custom cards.

 

This system makes it possible to do things such as -

  1. creating unique equipments in the game with unique stats.
  2. creating dynamic equipments with options. (possibly with an equipment levelling system)
  3. if one is lazy, not having to put a description in the item and providing it with desired stats through an npc?

 

The use of it ultimately depends on one's creative capabilities.

Share this post


Link to post
Share on other sites

 

 

As you might imagine, Smoke is always involved in big, cool projects. I would like to congratulate you and thank you on behalf of the whole community.
 
However, I do not see so many great utilities in this ... I do not know if it is due to the difficulty of understanding the language, or because the text has not been clarified, but I have not really seen it. (Please do not get me wrong, I'm just curious)
 
Is this system official?
Is there any utility besides not having to create custom cards to give players bonuses?
 
I'm sorry I looked ignorant, but I'm just curious.

 

i guess it is a different way of displaying flavor text and equipment bonuses

 

 

 

 

As you might imagine, Smoke is always involved in big, cool projects. I would like to congratulate you and thank you on behalf of the whole community.
 
However, I do not see so many great utilities in this ... I do not know if it is due to the difficulty of understanding the language, or because the text has not been clarified, but I have not really seen it. (Please do not get me wrong, I'm just curious)
 
Is this system official?
Is there any utility besides not having to create custom cards to give players bonuses?
 
I'm sorry I looked ignorant, but I'm just curious.

 

This is an official system yes.

This doesn't have anything to do with creating custom cards.

 

This system makes it possible to do things such as -

  1. creating unique equipments in the game with unique stats.
  2. creating dynamic equipments with options. (possibly with an equipment levelling system)
  3. if one is lazy, not having to put a description in the item and providing it with desired stats through an npc?

 

The use of it ultimately depends on one's creative capabilities.

 

Thank you very much for clarifying my doubts. What I meant by custom cards is that bonuses could be given by creating custom cards too, you know?

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.