private void OnFurniList(DataInterceptedEventArgs e) { e.Continue(); IEnumerable <CHItem> items = CHItem.Parse(e.Packet) .Where(i => i.TypeId == 3 && !Photos.ContainsKey(i.Id)); int itemCount = items.Count(); HabboAlert alert = AlertBuilder.CreateAlert(HabboAlertType.Bubble, (itemCount == 0 ? Constants.SCANNING_EMPTY : itemCount.ToString()) + (itemCount == 1 ? Constants.SCANNING_SINGLE : Constants.SCANNING_MULTI) + Constants.SCANNING_INVENTORY_DONE) .WithImageUrl(Constants.BASE_URL + Constants.BUBBLE_ICON_URL); Connection.SendToClientAsync(alert.ToPacket(In.NotificationDialog)); //TODO: Show user the queueu in photo processing pipeline _isProcessingItems = true; //Send all photo items in inventory to photo data processing pipeline. foreach (CHItem item in items) { var photoItem = PhotoItem.Create(item.Id, item.ExtraData, Hotel, SessionUsername, roomId: null); _photoPublishingQueue.Enqueue(photoItem); } }
private async void OnItems(DataInterceptedEventArgs e) { e.Continue(); IEnumerable <HWallItem> items = HWallItem.Parse(e.Packet) .Where(i => i.TypeId == 3 && !Photos.ContainsKey(i.Id) && !_roomPhotoQueue.Contains(i.Id)); IEnumerable <int> unknownIds = await Api.BatchCheckExistingIdsAsync(items.Select(i => i.Id), Hotel).ConfigureAwait(false); int itemCount = items.Count(); int unknownCount = unknownIds.Count(); string alertMessage = (itemCount == 0 ? Constants.SCANNING_EMPTY : itemCount.ToString()) + (itemCount == 0 || itemCount > 1 ? Constants.SCANNING_MULTI : Constants.SCANNING_SINGLE) + Constants.SCANNING_WALLITEMS_DONE; if (unknownCount > 0) { alertMessage += " " + unknownCount + Constants.SCANNING_WALLITEMS_UNDISC; } HabboAlert alert = AlertBuilder.CreateAlert(HabboAlertType.Bubble, alertMessage) .WithImageUrl(Constants.BASE_URL + Constants.BUBBLE_ICON_URL); await Connection.SendToClientAsync(alert.ToPacket(In.NotificationDialog)).ConfigureAwait(false); _isProcessingItems = true; foreach (HWallItem item in items) { if (unknownIds.Contains(item.Id)) { _roomPhotoQueue.Enqueue(item.Id); _roomPhotoItems.TryAdd(item.Id, item); } else { //TODO: Another pipeline. await GetKnownPhotoByIdAsync(item.Id); } } }