- Joined
- Feb 14, 2015
- Messages
- 5,643
- Solutions
- 559
- Reaction score
- 3,949
Code: infernumx/forgottenserver (https://github.com/infernumx/forgottenserver/compare/master...infernumx:lua-item-desc)
There's still some room for improvement. I'm thinking about combining the "hasX" functions into one that returns the table with all the item type "flags" on it (boolean flags), would probably make it cleaner in the source code.
I tried to test a large chunk of items and compare them to the original description generated from Item::getDescription, I've found no discrepancies thus far between the two, it should perfectly mimic the exact same description you get from the original.
Obviously, I'll have to alter more of the code to make it like the original (support ItemType descriptions and utilize the Lua-generated description in playerOnLookInShop).
Pros:
What do you guys think?
There's still some room for improvement. I'm thinking about combining the "hasX" functions into one that returns the table with all the item type "flags" on it (boolean flags), would probably make it cleaner in the source code.
I tried to test a large chunk of items and compare them to the original description generated from Item::getDescription, I've found no discrepancies thus far between the two, it should perfectly mimic the exact same description you get from the original.
Obviously, I'll have to alter more of the code to make it like the original (support ItemType descriptions and utilize the Lua-generated description in playerOnLookInShop).
Pros:
- Flexible for new custom attributes
- Ability to easily alter the structure, order & layout of the text
- Shorter code (I combined the generic attributes/abilities that were added on weapons/armor into 1 function, in C++ you had to manually edit both to add a new attribute to parse)
- Anybody who's added new attributes in Item::getDescription will have to re-do it (maybe make it configurable?)
What do you guys think?
Last edited: