Jump to content
  • 0

About storage_storageadd


Mice

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  81
  • Reputation:   20
  • Joined:  12/24/18
  • Last Seen:  

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 Mice
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  234
  • Reputation:   103
  • Joined:  06/02/12
  • Last Seen:  

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;
	}
}

 

  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  81
  • Reputation:   20
  • Joined:  12/24/18
  • Last Seen:  

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...