summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatheus Macabu <mkbu95@gmail.com>2013-07-04 20:06:03 -0300
committerMatheus Macabu <mkbu95@gmail.com>2013-07-04 20:06:03 -0300
commite883e2b4d23cea61fc9f84a075248e999e071928 (patch)
tree65a10e5aadeb031a32353727786298fbaf6abc57
parentda064c030d22c0920f74b345ca3118c9204dae2b (diff)
downloadhercules-e883e2b4d23cea61fc9f84a075248e999e071928.tar.gz
hercules-e883e2b4d23cea61fc9f84a075248e999e071928.tar.bz2
hercules-e883e2b4d23cea61fc9f84a075248e999e071928.tar.xz
hercules-e883e2b4d23cea61fc9f84a075248e999e071928.zip
item_check config now deletes items from storage and guild storage. Suggestion topic #417, thanks to bgames23.
Signed-off-by: Matheus Macabu <mkbu95@gmail.com>
-rw-r--r--src/map/pc.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 04f72bfaa..e5a224e48 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -40,6 +40,7 @@
#include "script.h" // script_config
#include "skill.h"
#include "status.h" // struct status_data
+#include "storage.h"
#include "pc.h"
#include "pc_groups.h"
#include "quest.h"
@@ -8920,6 +8921,29 @@ int pc_checkitem(struct map_session_data *sd)
pc->cart_delitem(sd, i, sd->status.cart[i].amount, 0, LOG_TYPE_OTHER);
}
}
+
+ for( i = 0; i < MAX_STORAGE; i++ ) {
+ id = sd->status.storage.items[i].nameid;
+ if( id && !itemdb_available(id) ) {
+ ShowWarning("Removed invalid/disabled item id %d from storage (amount=%d, char_id=%d).\n", id, sd->status.storage.items[i].amount, sd->status.char_id);
+ storage->delitem(sd, i, sd->status.storage.items[i].amount);
+ storage->close(sd); // force closing
+ }
+ }
+
+ if (sd->state.gmaster_flag) {
+ struct guild_storage *guild_storage = gstorage->id2storage2(sd->state.gmaster_flag->guild_id);
+ if (guild_storage) {
+ for( i = 0; i < MAX_GUILD_STORAGE; i++ ) {
+ id = guild_storage->items[i].nameid;
+ if( id && !itemdb_available(id) ) {
+ ShowWarning("Removed invalid/disabled item id %d from guild storage (amount=%d, char_id=%d, guild_id=%d).\n", id, guild_storage->items[i].amount, sd->status.char_id, sd->state.gmaster_flag->guild_id);
+ gstorage->delitem(sd, guild_storage, i, guild_storage->items[i].amount);
+ gstorage->close(sd); // force closing
+ }
+ }
+ }
+ }
}
for( i = 0; i < MAX_INVENTORY; i++) {