Wytter Report post Posted July 12, 2005 Here's how the new storage will work in 1.0.2: All categories in the storage will be defined by one of these: typedef enum { STORAGE_FOOD = 1, STORAGE_COINS, STORAGE_FLOWERS, STORAGE_ORES, STORAGE_METALS, STORAGE_MINERALS, STORAGE_TOOLS, STORAGE_WEAPONS, STORAGE_ARMOR, STORAGE_MAGIC, STORAGE_ESSENCES, STORAGE_POTIONS, STORAGE_ANIMAL, STORAGE_CLOTHES, STORAGE_MISC, STORAGE_JEWELRY, STORAGE_BOOKS, STORAGE_QUEST, STORAGE_END, STORAGE_ALL=0xffffff } client_categories; We may add more later. A storage may not have all storage types. On open you'll recieve the storage categories in pseudo C: *((Uint8*)(str+0)=STORAGE_LIST; *((Uint16*)(str+1)=length; *((Uint8*)(str+3)=no_categories; ptr=str+4; for(i=0;i<length-3;i++){ *((Uint8*)(ptr+0))=category_id; ((Uint8*)(ptr+1))=category_name; //terminated by \0 increase(ptr); } Now, to see what's in a category you have to send: *((Uint8*)(str+0))=GET_STORAGE_CATEGORY; *((Uint16*)(str+1))=2; *((Uint8 *)(str+3))=category; When you receive the category it will be packed like this: *((Uint8*)(str+0))=STORAGE_ITEMS; *((Uint16*)(str+1))=length; *((Uint8*)(str+3))=no_items; if(no_items==255){ //It's just an update containing 1 item for the current category *((Uint8*)((str+4))=category; *((Uint16*)(str+5))=image_id; *((Uint32*)(str+7))=quantity; *((Uint8*)(str+11))=storage_pos;//Position in the server-side storage } else { *((Uint8*)(str+4))=category; ptr=str+5; for(i=0;i<no_items;i++){ *((Uint16*)(ptr))=image_id; *((Uint32*)(ptr+2))=quantity; *((Uint8*)(ptr+6))=storage_pos; increase(ptr); } } If you want to look at a storage item use: *((Uint8*)(str+0))=LOOK_AT_STORAGE_ITEM; *((Uint16*)(str+1))=2; *((Uint8*)(str+3))=storage_pos; Then you'll recieve: *((Uint8*)(str+0))=STORAGE_TEXT; *((Uint16*)(str+1))=length; ((Uint8*)(str+3))=string; To withdraw an item use: *((Uint8*)(str+0))=WITHDRAW_ITEM; *((Uint16*)(str+1))=length; *((Uint8*)(str+3))=storage_pos; *((Uint32*)(str+4))=quantity; You have to be in the same category as the item to withdraw it. To deposite an item use: *((Uint8*)(str+0))=DEPOSITE_ITEM; *((Uint16*)(str+1))=length; *((Uint8*)(str+3))=inventory_pos;//Position in the items_list *((Uint32*)(str+4))=quantity; You have to be in the same category as the item to deposite it. Share this post Link to post Share on other sites
Puntif Report post Posted July 13, 2005 Will the string returned by LOOK_AT_STORAGE_ITEM be the same as the one for the other kinds of LOOK_AT_ITEMs? Share this post Link to post Share on other sites
Wytter Report post Posted July 13, 2005 It will be: *((Uint8*)(str+0))=STORAGE_TEXT; *((Uint16*)(str+1))=length; ((Uint8*)(str+3))=string; The text returned will only hold the item name and not the description. Share this post Link to post Share on other sites
(Athosino) Report post Posted July 13, 2005 i dont find it way too readable... Share this post Link to post Share on other sites
dns_server Report post Posted July 13, 2005 how will player tradeing change? will it use the above protacol or the current protacol? is that code just for npc's? Share this post Link to post Share on other sites
Wytter Report post Posted July 13, 2005 I will add documentation about the trading tomorrow or later this week. You will speak with an NPC to open the storage interface. When you reply 1 to him, it'll send the storage categories to you. I found out that there was a bug in the protocol information I gave you about STORAGE_ITEMS. Here's the corrected version: *((Uint8*)(str+0))=STORAGE_ITEMS; *((Uint16*)(str+1))=length; *((Uint8*)(str+3))=no_items; if(no_items==255){ //It's just an update containing 1 item for the current category *((Uint8*)((str+4))=category; *((Uint16*)(str+5))=image_id; *((Uint32*)(str+7))=quantity; *((Uint8*)(str+11))=storage_pos;//Position in the server-side storage } else { *((Uint8*)(str+4))=category; ptr=str+5; for(i=0;i<no_items;i++){ *((Uint16*)(ptr))=image_id; *((Uint32*)(ptr+2))=quantity; *((Uint8*)(ptr+6))=storage_pos; increase(ptr); } } Share this post Link to post Share on other sites
Drakos7 Report post Posted October 12, 2005 (edited) when we DEPOSITE_ITEM, is there any way to get the storage position/ID back? edit never mind. i found the code in get_storage_items Edited October 12, 2005 by Drakos7 Share this post Link to post Share on other sites
Drakos7 Report post Posted November 21, 2005 (edited) typedef enum { ... STORAGE_QUEST, STORAGE_END, STORAGE_ALL=0xffffff } client_categories; Sorry if this is a dense question. Does this imply that there is a way to get a listing of ALL the items (in the storage interface as opposed to the #sto command)? Edited November 21, 2005 by Drakos7 Share this post Link to post Share on other sites
Wytter Report post Posted November 23, 2005 Well, yes but I disabled it. Share this post Link to post Share on other sites
Drakos7 Report post Posted January 9, 2006 Bringing up and old subject again... Since each item is stored in a unique slot within storage (0,1,2,...) regardless of the category, would it be possible to just withdraw based upon that slot ID instead of having to switch to the category first? Several items list in multiple categories showing that the actual category does not matter much. In terms of a bot this would reduce one step of network calls. Share this post Link to post Share on other sites
Drakos7 Report post Posted January 9, 2006 The code above for withdrawing an item differs from the items.c method. Which is better to do? items.c: str[0]=WITHDRAW_ITEM; str[1]=position; *((Uint32*)(str+2))=SDL_SwapLE32(quantity); Share this post Link to post Share on other sites