Jump to content

Storage Types Optimization


Aleos

Recommended Posts


  • Group:  Development Manager
  • Topic Count:  56
  • Topics Per Day:  0.01
  • Content Count:  732
  • Reputation:   525
  • Joined:  12/13/11
  • Last Seen:  

Storage Types Optimization
As of Git Hash: ade1b17, rAthena has moved the Cart, Inventory, and Storage types out of the mmo_charstatus!

What does this mean to you?

  • These storage types now mimic Guild Storage and can be loaded/saved whenever needed.
  • Relieves mmo_charstatus from having to send storage types and lets the char-server handle it.
  • All item storage types now have an increased max amount.
  • Custom Storages can be created in conf/inter_server.conf which mimics official behavior of secondary Storages.
    • Each Premium Storage behaves as a unique Storage for players to access.
    • Images below show it in use.
  • Fixes players having to log out to resync cart item data before opening a Vending Store.
  • Refactored player weight and cart weight calculations into their own functions.
  • Added script commands openstorage2 (for premium Storages), guildstoragecountitem[2] and guildstoragedelitem[2].
  • Refactored several function return types as well as documentation.
Quote

*guildstoragecountitem(<nameID>{,<accountID>})
*guildstoragecountitem("<item name>"{,<accountID>})

This command behaves identically to 'countitem', but counts items from the player's
cart, storage, or guild storage.

If no cart is mounted, 'cartcountitem' will return -1.
If player is not in a guild or storage is open, 'guildstoragecountitem' will return -1.


---------------------------------------

*guildstoragecountitem2(<nameID>,<Identified>,<Refine>,<Attribute>,<Card0>,<Card1>,<Card2>,<Card3>{,<accountID>})
*guildstoragecountitem2("<item name>",<Identified>,<Refine>,<Attribute>,<Card0>,<Card1>,<Card2>,<Card3>{,<accountID>})

This command behaves identically to 'countitem2', but counts items from the player's
cart, storage, or guild storage.

If no cart is mounted, 'cartcountitem2' will return -1.
If player is not in a guild or storage is open, 'guildstoragecountitem2' will return -1.

---------------------------------------

*guildstoragedelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
*guildstoragedelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};

This command behaves identically to 'delitem2', but deletes items from the player's
cart, storage, or guild storage.

If no cart is mounted, 'cartdelitem2' will return -1.
If player is not in a guild or storage is open, 'guildstoragedelitem2' will return -1.

---------------------------------------

*openstorage2 <storage_id>,<mode>{,<account_id>};

Just like the 'openstorage' command, except this command can open additional storages
by the specified <storage_id>. For <storage_id>, please read the conf/inter_server.conf
for storage groups.

Values for <mode> are:
    STOR_MODE_NONE : Player only can read the storage entries.
    STOR_MODE_GET  : Player can get items from the storage.
    STOR_MODE_PUT  : Player can put items in the storage.

Example:
    if (vip_status(1)) {
        mes "I will open your Premium storage.";
        mes "Thank you for using our service.";
        close2;
        openstorage2 1,STOR_MODE_GET|STOR_MODE_PUT;
    } else {
        mes "Sorry, your Premium status is expired.";
        mes "Storage will be opened but you can't put any item into it.";
        close2;
        openstorage2 1,STOR_MODE_GET;
    }
    end;

Thanks to @Cydh for his work on the Premium Storage support and thanks to @Lighta for the initial support on creating the cleanup. Thanks to everyone else who tested the PR and helped it come to fruition!

storage-normal.jpg

storage-premium.jpg

storage-vip.jpg

  • Upvote 14
Link to comment
Share on other sites


  • Group:  Development Manager
  • Topic Count:  56
  • Topics Per Day:  0.01
  • Content Count:  732
  • Reputation:   525
  • Joined:  12/13/11
  • Last Seen:  

It ended up being an early Christmas gift. :)

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  153
  • Reputation:   8
  • Joined:  07/01/14
  • Last Seen:  

That's pretty neat!

 

 

57 68 65 6e 20 72 69 63 68 2c 20 74 68 69 6e 6b 20 6f 66 20 70 6f 76 65 72 74 79 2c 20 62 75 74 20 64 6f 6e 27 74 20 74 68 69 6e 6b 20 6f 66 20 72 69 63 68 65 73 20 77 68 65 6e 20 79 6f 75 20 61 72 65 20 70 6f 6f 72

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

I really like this kind of VIP system.. thanks guys!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

Nice to see it finally release =) you guys did a tons of job on it ;)

Link to comment
Share on other sites

  • 6 years later...

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  35
  • Reputation:   2
  • Joined:  02/15/13
  • Last Seen:  

Nice to see it finally release  = thankyou

Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  1176
  • Reputation:   159
  • Joined:  06/12/12
  • Last Seen:  

can't find inter_server.conf.

is it change into inter_server.yml ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

On 3/17/2023 at 9:00 PM, hendra814 said:

can't find inter_server.conf.

is it change into inter_server.yml ?

yes new emu moved into inter_server.yml for new storage

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  1176
  • Reputation:   159
  • Joined:  06/12/12
  • Last Seen:  

13 hours ago, LearningRO said:

yes new emu moved into inter_server.yml for new storage

thanks, but getting error when try the npc

Quote

[Error]: intif_parse_StorageReceived: Failed to load! (AID: 2000000, type: 3)

here my inter_server.yml

# Config for Storages
#
# To access the premium storage, use script command 'openstorage2'.
# If premium storages are added, copy the structure of the storage table and match the table name in this config.
# The 'max' of premium storages are not adjusted by 'vip_storage_increase' config nor MIN_STORAGE.
#
# Structure:
#	- ID: <storage_id>          // (int) Storage ID will be used for script command 'openstorage2'.
#	  Name: "<storage name>"    // (string) Storage name will be sent to the client to display on the title bar.
#	  Table: "<storage_table>"  // (string) Name of table where storage is saved. The table stucture is the same as the default storage table.
#	  Max: <max_amount>         // (int) *optional* Maximum number of items in storage. MAX_STORAGE will be used if no value is defined.
###############################################################################################################################################
Header:
  Type: INTER_SERVER_DB
  Version: 1

Body:
   - ID: 1
     Name: "Personal"
     Table: "storage_1"
     Max: 100
   - ID: 2
     Name: "VIP Storage"
     Table: "vip_storage"
     Max: 300

 

and here the npc script

Welgaia,151,125,4	script	storage	94,{
    mes "[ Kafra ]";
    mes "Which storage do you want to open?";
    next;
    switch(select("Personal Storage","VIP Storage")) {
        case 1:
            mes "[ Kafra ]";
            mes "Premium storage will be opened";
            close2;
            openstorage2(1,STOR_MODE_GET|STOR_MODE_PUT);
            break;
        case 2:
            mes "[ Kafra ]";
            if (vip_status(1)) {
                .@mode = STOR_MODE_GET|STOR_MODE_PUT;
                mes "VIP will be opened. Thank you";
            } else {
                .@mode = STOR_MODE_GET;
                mes "Seems you're no longer VIP anymore. You only can take the items.";
            }
            close2;
            openstorage2(2,.@mode);
            break;
    }
    end;
}

Is this need sql update for create new storage table? Because from Cydh example don't  have information for sql part.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

already add new table on database?
storage_1
vip_storage

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  1176
  • Reputation:   159
  • Joined:  06/12/12
  • Last Seen:  

8 minutes ago, LearningRO said:

already add new table on database?
storage_1
vip_storage

Not yet, i don't know to create it.

can i use this sql script to create it? this is from my collection script personal storage.

CREATE TABLE IF NOT EXISTS `storage_char_0` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `account_id` int(11) unsigned NOT NULL DEFAULT '0',
  `nameid` smallint(5) unsigned NOT NULL DEFAULT '0',
  `amount` smallint(11) unsigned NOT NULL DEFAULT '0',
  `equip` int(11) unsigned NOT NULL DEFAULT '0',
  `identify` smallint(6) unsigned NOT NULL DEFAULT '0',
  `refine` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `attribute` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `card0` smallint(5) unsigned NOT NULL DEFAULT '0',
  `card1` smallint(5) unsigned NOT NULL DEFAULT '0',
  `card2` smallint(5) unsigned NOT NULL DEFAULT '0',
  `card3` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_id0` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_val0` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_parm0` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `option_id1` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_val1` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_parm1` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `option_id2` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_val2` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_parm2` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `option_id3` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_val3` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_parm3` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `option_id4` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_val4` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_parm4` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `expire_time` int(11) unsigned NOT NULL DEFAULT '0',
  `bound` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `unique_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `account_id` (`account_id`)
) ENGINE=MyISAM AUTO_INCREMENT=3169 DEFAULT CHARSET=utf8;
Edited by hendra814
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

8 minutes ago, hendra814 said:

Not yet, i don't know to create it.

can i use this sql script to create it? this is from my collection script personal storage.

CREATE TABLE IF NOT EXISTS `storage_char_0` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `account_id` int(11) unsigned NOT NULL DEFAULT '0',
  `nameid` smallint(5) unsigned NOT NULL DEFAULT '0',
  `amount` smallint(11) unsigned NOT NULL DEFAULT '0',
  `equip` int(11) unsigned NOT NULL DEFAULT '0',
  `identify` smallint(6) unsigned NOT NULL DEFAULT '0',
  `refine` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `attribute` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `card0` smallint(5) unsigned NOT NULL DEFAULT '0',
  `card1` smallint(5) unsigned NOT NULL DEFAULT '0',
  `card2` smallint(5) unsigned NOT NULL DEFAULT '0',
  `card3` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_id0` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_val0` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_parm0` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `option_id1` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_val1` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_parm1` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `option_id2` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_val2` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_parm2` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `option_id3` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_val3` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_parm3` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `option_id4` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_val4` smallint(5) unsigned NOT NULL DEFAULT '0',
  `option_parm4` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `expire_time` int(11) unsigned NOT NULL DEFAULT '0',
  `bound` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `unique_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `account_id` (`account_id`)
) ENGINE=MyISAM AUTO_INCREMENT=3169 DEFAULT CHARSET=utf8;

just dummy from storage table and rename with same name in your config inter_server.yml
image.png.7d1a82007c719c870c32d37d51a0097f.png

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  1176
  • Reputation:   159
  • Joined:  06/12/12
  • Last Seen:  

5 minutes ago, LearningRO said:

just dummy from storage table and rename with same name in your config inter_server.yml
image.png.7d1a82007c719c870c32d37d51a0097f.png

ok done, copy from storage sql into storage_1 and vip_storage.

now i can open the new storage service

Thanks you for the information

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

1 hour ago, hendra814 said:

ok done, copy from storage sql into storage_1 and vip_storage.

now i can open the new storage service

Thanks you for the information

ur welcome ?

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
Reply to this topic...

×   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...