Mice Posted yesterday at 03:21 PM Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 82 Reputation: 20 Joined: 12/24/18 Last Seen: 3 hours ago Share Posted yesterday at 03:21 PM (edited) Hello, this is Cydh's @autostore feature. // @autostore [Cydh] if (autostoring && sd->state.autostore && !item->expire_time && !id->flag.autoequip && !sd->state.storage_flag && !sd->npc_id) { if ((!sd->autostore_weight || (sd->autostore_weight && get_percentage(sd->weight, sd->max_weight) >= sd->autostore_weight)) && ( (sd->autostore_type&1 && (id->type == IT_HEALING || id->type == IT_USABLE || id->type == IT_DELAYCONSUME || id->type == IT_CASH)) || (sd->autostore_type&2 && (id->type == IT_ARMOR || id->type == IT_WEAPON || id->type == IT_SHADOWGEAR || id->type == IT_PETEGG || id->type == IT_PETARMOR)) || (sd->autostore_type&4 && (id->type == IT_ETC || id->type == IT_AMMO || id->type == IT_UNKNOWN || id->type == IT_UNKNOWN2)) || (sd->autostore_type&8 && id->type == IT_CARD) ) ) { char output[CHAT_SIZE_MAX]; sd->weight += w; clif_updatestatus(*sd, SP_WEIGHT); storage_storageadd(sd, &sd->storage, i, amount); storage_storageclose(sd); clif_storageclose(*sd); sprintf(output, "[ Autostore ] %dx %s", amount, id->ename.c_str()); clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); achievement_update_objective(sd, AG_GET_ITEM, 1, id->value_sell); return ADDITEM_SUCCESS; } } ---------------------------------------------------------- - ID: 2 Name: "Storage 2" Table: storage2 Max: 300 - ID: 3 Name: "Storage 3" Table: storage3 Max: 300 This is the part where it stores the item in the storage. storage_storageadd(sd, &sd->storage, i, amount); Any idea how I can call storage ID: 2 or 3 in that part, so that the item to be autostored will go to the custom storage I created?" Edited yesterday at 03:22 PM by Mice Quote Link to comment Share on other sites More sharing options...
0 Racaae Posted 18 hours ago Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 235 Reputation: 104 Joined: 06/02/12 Last Seen: 2 hours ago Share Posted 18 hours ago Hello, change storage to premiumStorage. You can try my changes. I can't test it with just the code provided. // @autostore [Cydh] if (autostoring && sd->state.autostore && !item->expire_time && !id->flag.autoequip && !sd->state.storage_flag && !sd->npc_id) { if ((!sd->autostore_weight || (sd->autostore_weight && get_percentage(sd->weight, sd->max_weight) >= sd->autostore_weight)) && ( (sd->autostore_type&1 && (id->type == IT_HEALING || id->type == IT_USABLE || id->type == IT_DELAYCONSUME || id->type == IT_CASH)) || (sd->autostore_type&2 && (id->type == IT_ARMOR || id->type == IT_WEAPON || id->type == IT_SHADOWGEAR || id->type == IT_PETEGG || id->type == IT_PETARMOR)) || (sd->autostore_type&4 && (id->type == IT_ETC || id->type == IT_AMMO || id->type == IT_UNKNOWN || id->type == IT_UNKNOWN2)) || (sd->autostore_type&8 && id->type == IT_CARD) ) ) { char output[CHAT_SIZE_MAX]; sd->weight += w; clif_updatestatus(*sd, SP_WEIGHT); int32 stor_id = 2; //Storage ID to autostore if (stor_id) storage_premiumStorage_load(sd, stor_id, STOR_MODE_PUT); if (sd->state.storage_flag == 3) { storage_storageadd(sd, &sd->premiumStorage, i, amount); storage_premiumStorage_close(sd); } else { storage_storageadd(sd, &sd->storage, i, amount); storage_storageclose(sd); clif_storageclose(*sd); } sprintf(output, "[ Autostore ] %dx %s", amount, id->ename.c_str()); clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); achievement_update_objective(sd, AG_GET_ITEM, 1, id->value_sell); return ADDITEM_SUCCESS; } } 1 Quote Link to comment Share on other sites More sharing options...
0 Mice Posted 13 hours ago Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 82 Reputation: 20 Joined: 12/24/18 Last Seen: 3 hours ago Author Share Posted 13 hours ago 5 hours ago, Racaae said: Hello, change storage to premiumStorage. You can try my changes. I can't test it with just the code provided. // @autostore [Cydh] if (autostoring && sd->state.autostore && !item->expire_time && !id->flag.autoequip && !sd->state.storage_flag && !sd->npc_id) { if ((!sd->autostore_weight || (sd->autostore_weight && get_percentage(sd->weight, sd->max_weight) >= sd->autostore_weight)) && ( (sd->autostore_type&1 && (id->type == IT_HEALING || id->type == IT_USABLE || id->type == IT_DELAYCONSUME || id->type == IT_CASH)) || (sd->autostore_type&2 && (id->type == IT_ARMOR || id->type == IT_WEAPON || id->type == IT_SHADOWGEAR || id->type == IT_PETEGG || id->type == IT_PETARMOR)) || (sd->autostore_type&4 && (id->type == IT_ETC || id->type == IT_AMMO || id->type == IT_UNKNOWN || id->type == IT_UNKNOWN2)) || (sd->autostore_type&8 && id->type == IT_CARD) ) ) { char output[CHAT_SIZE_MAX]; sd->weight += w; clif_updatestatus(*sd, SP_WEIGHT); int32 stor_id = 2; //Storage ID to autostore if (stor_id) storage_premiumStorage_load(sd, stor_id, STOR_MODE_PUT); if (sd->state.storage_flag == 3) { storage_storageadd(sd, &sd->premiumStorage, i, amount); storage_premiumStorage_close(sd); } else { storage_storageadd(sd, &sd->storage, i, amount); storage_storageclose(sd); clif_storageclose(*sd); } sprintf(output, "[ Autostore ] %dx %s", amount, id->ename.c_str()); clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); achievement_update_objective(sd, AG_GET_ITEM, 1, id->value_sell); return ADDITEM_SUCCESS; } } Hello, it works, but there are some issues I can't figure out. Here's what's happening: On your first login, if you use AutoStore and pick up loot, Storage ID: 2 opens once but doesn't close. However, the item you picked up goes into your main storage instead of Storage ID: 2. After that, any new loot you pick up correctly goes into Storage ID: 2. But if you relog, the same issue happens again. However, if you open Storage ID: 2 first after relogging, everything works fine. So overall, the system works it’s just that the first opening of the storage causes the issue. Quote Link to comment Share on other sites More sharing options...
0 Racaae Posted 3 hours ago Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 235 Reputation: 104 Joined: 06/02/12 Last Seen: 2 hours ago Share Posted 3 hours ago 9 hours ago, Mice said: Hello, it works, but there are some issues I can't figure out. Here's what's happening: On your first login, if you use AutoStore and pick up loot, Storage ID: 2 opens once but doesn't close. However, the item you picked up goes into your main storage instead of Storage ID: 2. After that, any new loot you pick up correctly goes into Storage ID: 2. But if you relog, the same issue happens again. However, if you open Storage ID: 2 first after relogging, everything works fine. So overall, the system works it’s just that the first opening of the storage causes the issue. The main storage (ID 0) is the only one that's always loaded. Extra storages (IDs 1, 2, 3...) are only loaded when requested, and only one can be loaded at a time. When the code requests storage ID 2, it doesn't load fast enough, so the lines that add the item and close the storage are executed too early. That's why the storage remains open the first time. The same thing happens when the player opens another extra storage, since storage ID 2 gets switched to a different one. 1 Quote Link to comment Share on other sites More sharing options...
0 Mice Posted 3 hours ago Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 82 Reputation: 20 Joined: 12/24/18 Last Seen: 3 hours ago Author Share Posted 3 hours ago 8 minutes ago, Racaae said: The main storage (ID 0) is the only one that's always loaded. Extra storages (IDs 1, 2, 3...) are only loaded when requested, and only one can be loaded at a time. When the code requests storage ID 2, it doesn't load fast enough, so the lines that add the item and close the storage are executed too early. That's why the storage remains open the first time. The same thing happens when the player opens another extra storage, since storage ID 2 gets switched to a different one. Thank you very much for your beautiful explanation. Now I understand why even if I load in clif_parse_LoadEndAck, it still doesn't work properly. It's because of that. I understand it much better now thanks to your explanation. Thank you so much. The code you provided is a big help to me. I will just use it and add a confirmation so that the storage with ID: 2 will automatically open via a script for checking in order to initialize it. Quote Link to comment Share on other sites More sharing options...
Question
Mice
Hello, this is Cydh's @autostore feature.
// @autostore [Cydh] if (autostoring && sd->state.autostore && !item->expire_time && !id->flag.autoequip && !sd->state.storage_flag && !sd->npc_id) { if ((!sd->autostore_weight || (sd->autostore_weight && get_percentage(sd->weight, sd->max_weight) >= sd->autostore_weight)) && ( (sd->autostore_type&1 && (id->type == IT_HEALING || id->type == IT_USABLE || id->type == IT_DELAYCONSUME || id->type == IT_CASH)) || (sd->autostore_type&2 && (id->type == IT_ARMOR || id->type == IT_WEAPON || id->type == IT_SHADOWGEAR || id->type == IT_PETEGG || id->type == IT_PETARMOR)) || (sd->autostore_type&4 && (id->type == IT_ETC || id->type == IT_AMMO || id->type == IT_UNKNOWN || id->type == IT_UNKNOWN2)) || (sd->autostore_type&8 && id->type == IT_CARD) ) ) { char output[CHAT_SIZE_MAX]; sd->weight += w; clif_updatestatus(*sd, SP_WEIGHT); storage_storageadd(sd, &sd->storage, i, amount); storage_storageclose(sd); clif_storageclose(*sd); sprintf(output, "[ Autostore ] %dx %s", amount, id->ename.c_str()); clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); achievement_update_objective(sd, AG_GET_ITEM, 1, id->value_sell); return ADDITEM_SUCCESS; } } ---------------------------------------------------------- - ID: 2 Name: "Storage 2" Table: storage2 Max: 300 - ID: 3 Name: "Storage 3" Table: storage3 Max: 300
This is the part where it stores the item in the storage.
storage_storageadd(sd, &sd->storage, i, amount);
Any idea how I can call storage ID: 2 or 3 in that part, so that the item to be autostored will go to the custom storage I created?"
Edited by MiceLink to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.