Optimized Inventory, Cart Inventory, and Storage usage (#1115)

* 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 storage types now have an increased max amount.
* Implemented Premium Storage System. Thanks to @cydh!
* Fixes #441 - Players will no longer be required 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, guildstoragecountitem[2] and guildstoragedelitem[2].
* Refactored several function return types as well as documentation.
Thanks to @lighta and @cydh for their help with it!
This commit is contained in:
Aleos
2016-11-14 13:11:43 -05:00
committed by GitHub
49 changed files with 2528 additions and 1572 deletions

View File

@@ -1328,6 +1328,33 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.
desc:
- Delete pet data
0x308a
Type: ZI
Structure: <cmd>.W <type>.B <account_id>.L <char_id>.L
index: 0,2,3,7
len: 11
parameter:
- cmd : packet identification (0x308a)
- type : 0 - TABLE_INVENTORY, 1 - TABLE_CART, 2 - TABLE_STORAGE
- account_id
- char_id
desc:
- Request inventory/cart/storage data for a player/guild if type = 3
0x308b
Type: ZI
Structure: <size>.W <type>.B <account_id>.L <char_id>.L <entries>.?B
index: 0,2,4,5,9,13
len: 11
parameter:
- cmd : packet identification (0x308a)
- type : 0 - TABLE_INVENTORY, 1 - TABLE_CART, 2 - TABLE_STORAGE
- account_id
- char_id
- entries : Inventory/cart/storage entries that will be saved
desc:
- Request to save inventory/cart/storage entries
0x3090:
Type: ZI
Structure: <cmd>.W <s_homunculus>.W <aid>.L <sh>.?B
@@ -2139,6 +2166,46 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.
desc:
- Send pet deletion status
0x388a
Type: IZ
Structure: <cmd>.W <size>.W <type>.B <account_id>.L <result>.B <entries>.?B
index: 0,2,4,5,9
len: 9+variable
parameter:
- cmd : packet identification (0x388a)
- size
- type : Storage type, 0 - TABLE_INVENTORY, 1 - TABLE_CART, 2 - TABLE_STORAGE
- account_id
- result : True if data loaded, false if failed
- entries : Inventory/cart/storage entries
desc:
- Process inventory/cart/storage entries for player from inter-server
0x388b
Type: IZ
Structure: <cmd>.W <account_id>.L <result>.B <type>.B
index: 0,2,6,7
len: 11
parameter:
- cmd : packet identification (0x388b)
- account_id
- result : 1 - success, 0 - failed
- type : Storage type, 0 - TABLE_INVENTORY, 1 - TABLE_CART, 2 - TABLE_STORAGE
desc:
- Info about inventory/cart/storage data is saved
0x388c
Type: IZ
Structure: <cmd>.W <len>.W { <storage_table>.? }*?
index: 0,2,6,...
len: 6+variable
parameter:
- cmd : packet identification (0x388c)
- len : Pakcet length
- storage_table : Storage table information
desc:
- Receive storage information
0x3890
Type: IZ
Structure: <cmd>.W <size>.W <account_id>.L <flag>.B <s_homunculus>.?B

View File

@@ -4617,9 +4617,14 @@ database. If the name is not found, nothing will be deleted.
*cartdelitem "<item name>",<amount>{,<account ID>};
*storagedelitem <item id>,<amount>{,<account ID>};
*storagedelitem "<item name>",<amount>{,<account ID>};
*guildstoragedelitem <item id>,<amount>{,<account ID>};
*guildstoragedelitem "<item name>",<amount>{,<account ID>};
This command behaves identically to 'delitem', but deletes items from the player's
cart or storage. If no cart is mounted, 'cartdelitem' will fail.
cart, storage, or guild storage.
If no cart is mounted, 'cartdelitem' will return -1.
If player is not in a guild or storage is open, 'guildstoragedelitem' will return -1.
---------------------------------------
@@ -4635,9 +4640,14 @@ See 'getitem2' for an explanation of the expanded parameters.
*cartdelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
*storagedelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
*storagedelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
*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 or storage. If no cart is mounted, 'cartdelitem2' will fail.
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.
---------------------------------------
@@ -4663,13 +4673,18 @@ adding up strings:
---------------------------------------
*cartcountitem(<item id>)
*cartcountitem("<item name>")
*storagecountitem(<item id>)
*storagecountitem("<item name>")
*cartcountitem(<item id>{,<accountID>})
*cartcountitem("<item name>"{,<accountID>})
*storagecountitem(<item id>{,<accountID>})
*storagecountitem("<item name>"{,<accountID>})
*guildstoragecountitem(<nameID>{,<accountID>})
*guildstoragecountitem("<item name>"{,<accountID>})
This command behaves identically to 'countitem', but counts items from the player's
cart or storage. If no cart is mounted, 'cartcountitem' will return -1.
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.
---------------------------------------
@@ -4684,13 +4699,18 @@ See 'getitem2' for an explanation of the expanded parameters.
---------------------------------------
*cartcountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
*cartcountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
*storagecountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
*storagecountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
*cartcountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
*cartcountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
*storagecountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
*storagecountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
*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 or storage. If no cart is mounted, 'cartcountitem2' will return -1.
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.
---------------------------------------
@@ -5054,6 +5074,33 @@ window, to avoid any disruption when both windows overlap.
---------------------------------------
*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;
---------------------------------------
*openmail({<char_id>});
This will open a character's Mail window on the client connected to the