From 974222a8d3f189083205bf5d330de04a43226ad3 Mon Sep 17 00:00:00 2001 From: Smokexyz Date: Thu, 2 Mar 2017 19:24:48 +0800 Subject: Implementation of Item Options 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 lua file to avoid bugs. IT_OPT_* keys and MAX_ITEM_OPTIONS macro are also exported from the source as constants. An additional flag `disable_options` has been added to sql, and as `DisableOptions: true/false (boolean, defaults to false !!for equipments only!!)` to item_db.conf files. Script commands documentation is also included. SQL file updates are included. Credits: [Smokexyz](https://github.com/Smokexyz) Style and Script Fixes by [Asheraf](https://github.com/Asheraf) Initial design Idea by [secretdataz](https://github.com/secretdataz) --- src/common/HPMDataCheck.h | 3 ++- src/common/mmo.h | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 0a4af75dd..2a1c092b7 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -452,6 +452,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "item_combo", sizeof(struct item_combo), SERVER_TYPE_MAP }, { "item_data", sizeof(struct item_data), SERVER_TYPE_MAP }, { "item_group", sizeof(struct item_group), SERVER_TYPE_MAP }, + { "item_option", sizeof(struct item_option), SERVER_TYPE_MAP }, { "item_package", sizeof(struct item_package), SERVER_TYPE_MAP }, { "item_package_must_entry", sizeof(struct item_package_must_entry), SERVER_TYPE_MAP }, { "item_package_rand_entry", sizeof(struct item_package_rand_entry), SERVER_TYPE_MAP }, @@ -542,8 +543,8 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #ifdef MAP_PACKETS_STRUCT_H { "EQUIPITEM_INFO", sizeof(struct EQUIPITEM_INFO), SERVER_TYPE_MAP }, { "EQUIPSLOTINFO", sizeof(struct EQUIPSLOTINFO), SERVER_TYPE_MAP }, + { "ItemOptions", sizeof(struct ItemOptions), SERVER_TYPE_MAP }, { "NORMALITEM_INFO", sizeof(struct NORMALITEM_INFO), SERVER_TYPE_MAP }, - { "RndOptions", sizeof(struct RndOptions), SERVER_TYPE_MAP }, { "packet_additem", sizeof(struct packet_additem), SERVER_TYPE_MAP }, { "packet_authok", sizeof(struct packet_authok), SERVER_TYPE_MAP }, { "packet_banking_check", sizeof(struct packet_banking_check), SERVER_TYPE_MAP }, diff --git a/src/common/mmo.h b/src/common/mmo.h index 9c29b8a0e..35e66964c 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -256,6 +256,12 @@ #define MAX_ELESKILLTREE 3 #endif +// Maximum item options [Smokexyz] +#ifndef MAX_ITEM_OPTIONS +#define MAX_ITEM_OPTIONS 5 +#endif +STATIC_ASSERT(MAX_ITEM_OPTIONS <= 5, "This value is limited by the client and database layout and should only be increased if you know the consequences."); + // The following system marks a different job ID system used by the map server, // which makes a lot more sense than the normal one. [Skotlex] // These marks the "level" of the job. @@ -326,6 +332,12 @@ struct item { char favorite; unsigned char bound; uint64 unique_id; + + struct { + int16 index; + int16 value; + uint8 param; + } option[MAX_ITEM_OPTIONS]; }; //Equip position constants -- cgit v1.2.3-60-g2f50