Jump to content
  • 0
Sign in to follow this  
Virtue

Item Options script

Question

Spoiler
On 4/10/2017 at 2:29 PM, Smoke said:

Introducing the Item Options System!

 

k3TrEvc.png

 

Commit

https://github.com/HerculesWS/Hercules/commit/974222a8d3f189083205bf5d330de04a43226ad3

 

Feature Information

The Item Option System is a feature that was implemented in 2015-02-26 clients, allowing equipments to have up to 5 additional effects similar to cards or enchants. Each equipment is capable of having 5 information bars above the card slot/enchant bar that describes the effect of the option it is infused with.

 

New Script Commands (The following snippet is available in doc/script_commands.txt.)



*getequipisenableopt(<equipment slot>)

This function checks if the equipped item allows the use of bonus options.

Returns 1 if allowed, 0 if not.

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

*getequippedoptioninfo(<info_type>);

This function is to be used with the scripts of contents listed in
db/item_options.conf only.

Returns the value of the current equipment being parsed.
If the equip was not found or the type is invalid, -1 is returned.

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

*getequipoptioninfo(<equip_index>,<slot>,<type>);

Gets the option information of an equipment.

<equipment_index> For a list of equipment indexes see getequipid().
<option_slot> can range from 1 to MAX_ITEM_OPTIONS
<type> can be IT_OPT_INDEX (the ID of the option bonus, @see "Id" or "Name" in db/item_options.conf)       or IT_OPT_VALUE (the value of the bonus script of the equipment, @see "Script" in db_item_options.conf).

returns the value of the slot if exists or -1 for invalid slot, type or slots.

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

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

Set an equipment's option index or value for the specified option slot.

<equipment_index> For a list of equipment indexes see getequipid().
<option_slot> can range from 1 to MAX_ITEM_OPTIONS
<type> can be IT_OPT_INDEX (the ID of the option bonus, @see "Id" or "Name" in db/item_options.conf)
<value> The value of the type to be set.

returns 0 if value couldn't be set, 1 on success.

 

 

Release Notes

  • This system allows the infusing of equipments with bonus item options.
  • This feature is constrained to clients of packet versions greater than or equal to 20150226.
  • Item Options and their effects are defined server-side in db/item_options.conf and client side in data/luafiles514/lua files/datainfo/addrandomoptionnametable.lub
  • The ID of the option must tally with the correct index of the description provided in the client side file.
  • IT_OPT_* keys and MAX_ITEM_OPTIONS macro are also exported from the source as constants.
  • If you wish to disable item options for certain (equipment) items, an additional flag `disable_options` has been added to the item sql tables, and as `DisableOptions: true/false (boolean, defaults to false !!for equipments only!!)` to the item_db.conf files.
  • Documentation is provided for script commands.
  • If upgrading, don't forget to run the sql upgrade files!


Credits

A big thanks to all the reviewers that helped make the code closer to perfection. -

EmistrydastgirMishimaHarunaJedzkieRidley8819Asheraf4144.

 

Style and Script Fixes by Asheraf (https://github.com/Asheraf)
Initial design Idea in rAthena commit.

Looking for scripts for this, Item options for all equipments / costumes slots. no sample script located. I found two of them but it's outdated. will try and modify my thread after work.

Demo NPC from Utility

One from Scripting support

Edited by Virtue

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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.   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...
Sign in to follow this  

×
×
  • Create New...

Important Information

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