diff options
author | Haru <haru@dotalux.com> | 2018-03-11 15:38:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-11 15:38:44 +0100 |
commit | f7ca209c044d4c08e932beac8580ddc2c2d7a924 (patch) | |
tree | ba45501645cde4e56a20ca0674232d58f132c189 /src/map/rodex.c | |
parent | c46b6d59644675c7c037238afb609f42230a9977 (diff) | |
parent | 442162e0baf6d085ffde26fb7fafd9877338f868 (diff) | |
download | hercules-f7ca209c044d4c08e932beac8580ddc2c2d7a924.tar.gz hercules-f7ca209c044d4c08e932beac8580ddc2c2d7a924.tar.bz2 hercules-f7ca209c044d4c08e932beac8580ddc2c2d7a924.tar.xz hercules-f7ca209c044d4c08e932beac8580ddc2c2d7a924.zip |
Merge pull request #1987 from guilherme-gm/rodexfixes
Some rodex fixes
Diffstat (limited to 'src/map/rodex.c')
-rw-r--r-- | src/map/rodex.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/map/rodex.c b/src/map/rodex.c index d5a6064cf..8626f76e1 100644 --- a/src/map/rodex.c +++ b/src/map/rodex.c @@ -364,15 +364,24 @@ struct rodex_message *rodex_get_mail(struct map_session_data *sd, int64 mail_id) { int i; struct rodex_message *msg; + int char_id; nullpo_retr(NULL, sd); - ARR_FIND(0, VECTOR_LENGTH(sd->rodex.messages), i, VECTOR_INDEX(sd->rodex.messages, i).id == mail_id && VECTOR_INDEX(sd->rodex.messages, i).is_deleted != true); + ARR_FIND(0, VECTOR_LENGTH(sd->rodex.messages), i, VECTOR_INDEX(sd->rodex.messages, i).id == mail_id); if (i == VECTOR_LENGTH(sd->rodex.messages)) return NULL; msg = &VECTOR_INDEX(sd->rodex.messages, i); + char_id = sd->status.char_id; + + if ((msg->is_deleted == true) + || (msg->expire_date < time(NULL) && ((msg->receiver_accountid > 0) || (msg->receiver_id == char_id && msg->sender_id != char_id))) + || ((msg->send_date + 2 * RODEX_EXPIRE) < time(NULL)) + ) + return NULL; + return msg; } @@ -388,9 +397,16 @@ void rodex_read_mail(struct map_session_data *sd, int64 mail_id) msg = rodex->get_mail(sd, mail_id); nullpo_retv(msg); - if (msg->is_read == false) { - intif->rodex_updatemail(msg->id, 0); - msg->is_read = true; + if (msg->opentype == RODEX_OPENTYPE_RETURN) { + if (msg->sender_read == false) { + intif->rodex_updatemail(msg->id, 4); + msg->sender_read = true; + } + } else { + if (msg->is_read == false) { + intif->rodex_updatemail(msg->id, 0); + msg->is_read = true; + } } clif->rodex_read_mail(sd, msg->opentype, msg); @@ -440,6 +456,7 @@ void rodex_get_zeny(struct map_session_data *sd, int8 opentype, int64 mail_id) return; } + msg->type &= ~MAIL_TYPE_ZENY; msg->zeny = 0; intif->rodex_updatemail(mail_id, 1); @@ -523,6 +540,8 @@ void rodex_get_items(struct map_session_data *sd, int8 opentype, int64 mail_id) } } + msg->type &= ~MAIL_TYPE_ITEM; + msg->items_count = 0; intif->rodex_updatemail(mail_id, 2); clif->rodex_request_items(sd, opentype, mail_id, RODEX_GET_ITEMS_SUCCESS); |