summaryrefslogtreecommitdiff
path: root/src/map/rodex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/rodex.c')
-rw-r--r--src/map/rodex.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/map/rodex.c b/src/map/rodex.c
index c041ecc6b..dcecb6b8f 100644
--- a/src/map/rodex.c
+++ b/src/map/rodex.c
@@ -263,17 +263,38 @@ int rodex_send_mail(struct map_session_data *sd, const char *receiver_name, cons
for (i = 0; i < RODEX_MAX_ITEM; i++) {
int16 idx = sd->rodex.tmp.items[i].idx;
+ int j;
+ struct item *tmpItem = &sd->rodex.tmp.items[i].item;
+ struct item *invItem = &sd->status.inventory[idx];
- if (sd->rodex.tmp.items[i].item.nameid == 0)
+ if (tmpItem->nameid == 0)
continue;
- if (sd->rodex.tmp.items[i].item.nameid != sd->status.inventory[idx].nameid
- || sd->rodex.tmp.items[i].item.unique_id != sd->status.inventory[idx].unique_id
- || sd->rodex.tmp.items[i].item.amount > sd->status.inventory[idx].amount
- || sd->rodex.tmp.items[i].item.amount < 1) {
+ if (tmpItem->nameid != invItem->nameid ||
+ tmpItem->unique_id != invItem->unique_id ||
+ tmpItem->refine != invItem->refine ||
+ tmpItem->attribute != invItem->attribute ||
+ tmpItem->expire_time != invItem->expire_time ||
+ tmpItem->bound != invItem->bound ||
+ tmpItem->amount > invItem->amount ||
+ tmpItem->amount < 1) {
rodex->clean(sd, 1);
return RODEX_SEND_MAIL_ITEM_ERROR;
}
+ for (j = 0; j < MAX_SLOTS; j++) {
+ if (tmpItem->card[j] != invItem->card[j]) {
+ rodex->clean(sd, 1);
+ return RODEX_SEND_MAIL_ITEM_ERROR;
+ }
+ }
+ for (j = 0; j < MAX_ITEM_OPTIONS; j++) {
+ if (tmpItem->option[j].index != invItem->option[j].index ||
+ tmpItem->option[j].value != invItem->option[j].value ||
+ tmpItem->option[j].param != invItem->option[j].param) {
+ rodex->clean(sd, 1);
+ return RODEX_SEND_MAIL_ITEM_ERROR;
+ }
+ }
}
if (total_zeny > 0 && pc->payzeny(sd, (int)total_zeny, LOG_TYPE_MAIL, NULL) != 0) {
@@ -526,13 +547,18 @@ void rodex_clean(struct map_session_data *sd, int8 flag)
/// User request to open rodex, load mails from char-server
/// @param sd : Who's requesting
/// @param open_type : Box Type (see RODEX_OPENTYPE)
-void rodex_open(struct map_session_data *sd, int8 open_type)
+void rodex_open(struct map_session_data *sd, int8 open_type, int64 first_mail_id)
{
+#if PACKETVER >= 20170419
+ const int type = 1;
+#else
+ const int type = 0;
+#endif
nullpo_retv(sd);
if (open_type == RODEX_OPENTYPE_ACCOUNT && battle_config.feature_rodex_use_accountmail == false)
open_type = RODEX_OPENTYPE_MAIL;
- intif->rodex_requestinbox(sd->status.char_id, sd->status.account_id, 0, open_type, 0);
+ intif->rodex_requestinbox(sd->status.char_id, sd->status.account_id, type, open_type, first_mail_id);
}
/// User request to read next page of mails
@@ -547,7 +573,7 @@ void rodex_next_page(struct map_session_data *sd, int8 open_type, int64 last_mai
if (open_type == RODEX_OPENTYPE_ACCOUNT && battle_config.feature_rodex_use_accountmail == false) {
// Should not happen
open_type = RODEX_OPENTYPE_MAIL;
- rodex->open(sd, open_type);
+ rodex->open(sd, open_type, 0);
return;
}