Jump to content
  • 0

What's the best way to add a new, custom attribute to items?


INREM

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  10
  • Reputation:   0
  • Joined:  05/27/21
  • Last Seen:  

Hi all: I'm trying to figure out the least disruptive way to add a totally new attribute, one just like "name", "weight", and so on, to items.  This would potentially apply to many of the items in the database, both equipment, usable and generic items, and have one of several values.  A string-type variable would be ideal.  I would like to be able to access this value from within scripts, and without disrupting anything else.

It seems like one way to do this without much violence to the server code itself would be to create a pseudo bonus (i.e., there's no real status effect, it just acts as a label), enter that in as part of the item script, and check for the presence or absence of the bonus (https://github.com/rathena/rathena/wiki/Adding-New-Bonuses), maybe just the substring itself.

But at the same time, that seems pretty hacky and not especially intuitive and could come with other disadvantages (and might not work for generic items?).

Alternatively, is there any chance that this could be as simple as adding another nested key-value pair ("INREMsSpecialAttribute") to the YML entry for each item I want to modify?  Would there be a supported way to retrieve that value through scripts, or would I need to add my own accessor function?  Assuming it's a relevant concern, would doing this risk screwing up code that accesses item properties through arrays instead of by a dictionary and expects to find any values in a certain order?

  - Id: 1101
    AegisName: Sword
    Name: Sword
    Type: Weapon
    SubType: 1hSword
    Buy: 100
    Weight: 500
    Attack: 25
    Range: 1
    Slots: 3
    INREMsSpecialAttribute: Whatever
    Jobs:
      Alchemist: true
      Assassin: true
      Blacksmith: true
      Crusader: true
      Knight: true
      Merchant: true
      Novice: true
      Rogue: true
      SuperNovice: true
      Swordman: true
      Thief: true
    Locations:
      Right_Hand: true
    WeaponLevel: 1
    EquipLevelMin: 2
    Refineable: true

Any advice would be appreciated.  Thanks.

Not sure if this is more of a "database support" question, a scripting question or a "source" question, but I figured I'll toss it out here first - if different subforum would be more appropriate, please let me know.

Edited by INREM
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  928
  • Reputation:   170
  • Joined:  04/05/13
  • Last Seen:  

You can add new YAML parser in src try to use 'find all' EquipLevelMin in Visual Studio then you can duplicate it to INREMsSpecialAttribute variables.

  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  10
  • Reputation:   0
  • Joined:  05/27/21
  • Last Seen:  

Much thanks.  Will look into that.

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