diff options
author | Emistry Haoyan <equinox1991@gmail.com> | 2019-07-30 14:15:21 +0800 |
---|---|---|
committer | Emistry Haoyan <equinox1991@gmail.com> | 2019-08-26 22:28:23 +0800 |
commit | d3205c2fac99c0ef42249664c98505c7adf324b4 (patch) | |
tree | 5e27d2d5c49277c88f2d19f36daaf68f63d42a83 /src/map/pc.c | |
parent | 307248a5eefca196660c75e06cb6d4d0b84e2c43 (diff) | |
download | hercules-d3205c2fac99c0ef42249664c98505c7adf324b4.tar.gz hercules-d3205c2fac99c0ef42249664c98505c7adf324b4.tar.bz2 hercules-d3205c2fac99c0ef42249664c98505c7adf324b4.tar.xz hercules-d3205c2fac99c0ef42249664c98505c7adf324b4.zip |
Update Siegfried Tokens support.
- allow player to revive if inventory consists of any type of siegfried tokens listed in the `ITMCHAIN_SIEGFRIED`.
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 24f71f47b..a2ed4fb8a 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -12215,6 +12215,29 @@ static int pc_have_magnifier(struct map_session_data *sd) } /** + * checks if player have any item that listed in item chain + * @param sd map_session_data of Player + * @param chain_id unsigned short of item chain id + * @return index of inventory, INDEX_NOT_FOUND if it is not found + */ +static int pc_have_item_chain(struct map_session_data *sd, unsigned short chain_id) +{ + if (chain_id >= itemdb->chain_count) { + ShowError("itemdb_chain_item: unknown chain id %d\n", chain_id); + return INDEX_NOT_FOUND; + } + + for (int n = 0; n < itemdb->chains[chain_id].qty; n++) { + struct item_chain_entry *entry = &itemdb->chains[chain_id].items[n]; + int index = pc->search_inventory(sd, entry->id); + if (index != INDEX_NOT_FOUND) + return index; + } + + return INDEX_NOT_FOUND; +} + +/** * Checks if player have basic skills learned. * @param sd Player Data * @param level Required Level of Novice Skill @@ -12823,6 +12846,7 @@ void pc_defaults(void) pc->update_idle_time = pc_update_idle_time; pc->have_magnifier = pc_have_magnifier; + pc->have_item_chain = pc_have_item_chain; pc->check_basicskill = pc_check_basicskill; |