// recive packet about storage data int mapif_load_storage(int fd,int account_id) { //load from DB storage_fromsql(account_id, storage); WFIFOW(fd,0)=0x3810; WFIFOW(fd,2)=sizeof(struct storage)+8; WFIFOL(fd,4)=account_id; memcpy(WFIFOP(fd,8),&storage[0],sizeof(struct storage)); WFIFOSET(fd,WFIFOW(fd,2)); return 0; }
/** * Requested inventory/cart/storage data for a player * ZI 0x308a <type>.B <account_id>.L <char_id>.L <storage_id>.B <mode>.B * @param fd */ bool mapif_parse_StorageLoad(int fd) { uint32 aid, cid; int type; uint8 stor_id, mode; struct s_storage stor; bool res = true; type = RFIFOB(fd,2); aid = RFIFOL(fd,3); cid = RFIFOL(fd,7); stor_id = RFIFOB(fd,11); memset(&stor, 0, sizeof(struct s_storage)); stor.stor_id = stor_id; //ShowInfo("Loading storage for AID=%d.\n", aid); switch (type) { case TABLE_INVENTORY: res = inventory_fromsql(cid, &stor); break; case TABLE_STORAGE: if (!inter_premiumStorage_exists(stor_id)) { ShowError("Invalid storage with id %d\n", stor_id); return false; } res = storage_fromsql(aid, &stor); break; case TABLE_CART: res = cart_fromsql(cid, &stor); break; default: return false; } mode = RFIFOB(fd, 12); stor.state.put = (mode&STOR_MODE_PUT) ? 1 : 0; stor.state.get = (mode&STOR_MODE_GET) ? 1 : 0; mapif_storage_data_loaded(fd, aid, type, stor, res); return true; }