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.