diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-03-08 11:45:01 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-03-08 11:45:01 -0300 |
commit | 05c1c0552fe6c94d8835a58f4608d0402614ce39 (patch) | |
tree | 25c6cddf9cd1767835266171d26d86d04882fdee /src/map/pc.c | |
parent | 36b0aad136e42687ed5f5383f8d93128d73c398b (diff) | |
download | hercules-05c1c0552fe6c94d8835a58f4608d0402614ce39.tar.gz hercules-05c1c0552fe6c94d8835a58f4608d0402614ce39.tar.bz2 hercules-05c1c0552fe6c94d8835a58f4608d0402614ce39.tar.xz hercules-05c1c0552fe6c94d8835a58f4608d0402614ce39.zip |
[TMW2] Hercules Ultimate Storage System
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index e9332ee46..e1da6f69d 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1268,9 +1268,11 @@ static bool pc_authok(struct map_session_data *sd, int login_id2, time_t expirat VECTOR_INIT(sd->channels); VECTOR_INIT(sd->script_queues); VECTOR_INIT(sd->achievement); // Achievements [Smokexyz/Hercules] - VECTOR_INIT(sd->storage.item); // initialize storage item vector. VECTOR_INIT(sd->hatEffectId); + // Storage + VECTOR_INIT(sd->storage.list); + sd->state.dialog = 0; sd->delayed_damage = 0; @@ -1505,7 +1507,8 @@ static int pc_reg_received(struct map_session_data *sd) sd->status.last_login = time(NULL); // Storage Request - intif->request_account_storage(sd); + for (i = 0; i < VECTOR_LENGTH(storage->configuration); i++) + intif->request_account_storage(sd, VECTOR_INDEX(storage->configuration, i).uid); intif->Mail_requestinbox(sd->status.char_id, 0); // MAIL SYSTEM - Request Mail Inbox intif->request_questlog(sd); @@ -10506,21 +10509,26 @@ static int pc_checkitem(struct map_session_data *sd) sd->itemcheck &= ~PCCHECKITEM_CART; } - if (sd->itemcheck & PCCHECKITEM_STORAGE && sd->storage.received == true) { - for (i = 0; i < VECTOR_LENGTH(sd->storage.item); i++) { - struct item *it = &VECTOR_INDEX(sd->storage.item, i); + if ((sd->itemcheck & PCCHECKITEM_STORAGE) != 0) { + for (i = 0; i < VECTOR_LENGTH(sd->storage.list); i++) { + struct storage_data *stor = &VECTOR_INDEX(sd->storage.list, i); - if ((id = it->nameid) == 0) - continue; + for (int j = 0; j < VECTOR_LENGTH(sd->storage.list); j++) { + struct item *it = &VECTOR_INDEX(stor->item, j); - if (!itemdb_available(id)) { - ShowWarning("pc_checkitem: Removed invalid/disabled item id %d from storage (amount=%d, char_id=%d).\n", id, it->amount, sd->status.char_id); - storage->delitem(sd, i, it->amount); - continue; + if ((id = it->nameid) == 0) + continue; + + if (itemdb_available(id) == 0) { + ShowWarning("pc_checkitem: Removed invalid/disabled item id %d from storage %d (amount=%d, char_id=%d).\n", id, stor->uid, it->amount, sd->status.char_id); + storage->delitem(sd, stor, i, it->amount); + continue; + } + + if (it->unique_id == 0 && itemdb->isstackable(id) == 0) + it->unique_id = itemdb->unique_id(sd); } - if (it->unique_id == 0 && itemdb->isstackable(id) == 0) - it->unique_id = itemdb->unique_id(sd); } storage->close(sd); |