diff options
author | Asheraf <acheraf1998@gmail.com> | 2018-09-21 13:20:29 +0100 |
---|---|---|
committer | Asheraf <acheraf1998@gmail.com> | 2018-09-23 03:17:25 +0100 |
commit | a2f18fad8e066fce131a9481bdf822d88eb91abf (patch) | |
tree | d1047031d99dc4b6ed45e13ec809160f4eec931a /src/map/quest.c | |
parent | 41ca3c7cc304cac90ae4df32217bd3237e035773 (diff) | |
download | hercules-a2f18fad8e066fce131a9481bdf822d88eb91abf.tar.gz hercules-a2f18fad8e066fce131a9481bdf822d88eb91abf.tar.bz2 hercules-a2f18fad8e066fce131a9481bdf822d88eb91abf.tar.xz hercules-a2f18fad8e066fce131a9481bdf822d88eb91abf.zip |
Add support for item amount range in setquestinfo
Diffstat (limited to 'src/map/quest.c')
-rw-r--r-- | src/map/quest.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/map/quest.c b/src/map/quest.c index 8cde4538e..02bf7638b 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -805,18 +805,17 @@ static bool quest_questinfo_validate_joblevel(struct map_session_data *sd, struc */ static bool quest_questinfo_validate_items(struct map_session_data *sd, struct questinfo *qi) { - int i, idx; - nullpo_retr(false, sd); nullpo_retr(false, qi); - - for (i = 0; i < VECTOR_LENGTH(qi->items); i++) { - struct item *item = &VECTOR_INDEX(qi->items, i); - idx = pc->search_inventory(sd, item->nameid); - if (idx == INDEX_NOT_FOUND) - return false; - if (sd->status.inventory[idx].amount < item->amount) + for (int i = 0; i < VECTOR_LENGTH(qi->items); i++) { + struct questinfo_itemreq *item = &VECTOR_INDEX(qi->items, i); + int count = 0; + for (int j = 0; j < MAX_INVENTORY; j++) { + if (sd->status.inventory[j].nameid == item->nameid) + count += sd->status.inventory[j].amount; + } + if (count < item->min || count > item->max) return false; } |