/// <summary> /// Takes the clipboard data, parses it and depending whether the item was desirable, outputs data /// </summary> /// <param name="clipboardString">Item data from the clipboard</param> private void ClipBoard_ItemParseTask(string clipboardString) { var item = new Item.Item(clipboardString); // If the item was s***e, discard it if (item.Discard) { System.Media.SystemSounds.Asterisk.Play(); foreach (var error in item.Errors) { Log(error, Flair.Error); } return; } // Get entries associated with item keys var entry = _priceManager.GetEntry(item.Key); // Display error if (entry == null) { Log($"No match for: {item.Key}", Flair.Warn); if (_config.FlagShowOverlay) { DisplayPriceBox("No match"); } return; } double price; if (_config.LowerPricePercentage > 0) { price = (entry.Value * (100 - _config.LowerPricePercentage)) / 100.0; } else { price = entry.Value; } // Round price var pow = Math.Pow(10, _config.PricePrecision); price = Math.Round(price * pow) / pow; // Replace "," with "." due to game limitations var strPrice = price.ToString().Replace(',', '.'); var note = $"{_config.NotePrefix} {strPrice} chaos"; // Log item price to main console Log($"{item.Key}: {price} chaos"); if (_config.FlagShowOverlay) { DisplayPriceBox($"{price} chaos"); return; } // Raise flag allowing next cb event to be processed if (_config.FlagSendNote) { _flagClipBoardPaste = true; Dispatcher.Invoke(() => Clipboard.SetText(note)); } }