private void HandleResult(AdvertJobResult result, AdvertEntry entry) { _logger.LogInformation($"({entry.RunningJobsCount} jobs) Grabber task successful ({result.Contacts?.Count ?? 0} contacts): " + result.Text?.Substring(0, Math.Min(result.Text.Length, 40))); // TODO: create export jobs entry.RunningJobsCount--; }
public AddVendorGump(AdvertEntry entry) : base(true) { m_Entry = entry; int length = AdvertSystem.Categories.Length; AddBackground(240, 0, 350, 80 + 20 * length, 3500); AddLabel(444, 16, 0, "Category:"); for (int i = 0; i < length; i++) { Category cat = AdvertSystem.Categories[i]; AddButton(416, 40+i*20, cat == m_Entry.Category ?209:208, 209, 1000 + i, GumpButtonType.Reply, 0); AddLabel(449, 40 +i *20, 0, cat.Name); } AddBackground(0, 0, 400, 360, 3500); AddBackground(100, 20, 200, 50, 9350); AddHtml(0, 25, 400, 20, Center("Advertisement System"), false, false); AddHtml(0, 45, 400, 20, Center("Add an Advertisement"), false, false); AddButton(30, 88, 4005, 4006, 2, GumpButtonType.Reply, 0); AddLabel(73, 89, 0, m_Entry.Vendor == null ? "No vendor assigned" : m_Entry.Vendor.Name); AddBackground(72, 123, 275, 100, 9350); AddButton(30, 122, 4005, 4006, 3, GumpButtonType.Reply, 0); AddTextEntry(83, 131, 252, 85, 0, 0, m_Entry.Description == "" ? "No description entered" : m_Entry.Description); AddBackground(72, 230, 161, 26, 9350); AddButton(29, 232, 4005, 4006, 4, GumpButtonType.Reply, 0); AddTextEntry(80, 235, 94, 17, 0, 1, m_Entry.Price.ToString()); AddLabel(180, 233, 0, "gp/use"); if (m_Entry.Price < AdvertSystem.Minimumprice) AddLabel(244, 235, 0, String.Format("Minimum price is {0}", AdvertSystem.Minimumprice)); AddLabel(74, 266, 0, "Rank with this price:"); if (m_Entry.Price < AdvertSystem.Minimumprice) AddLabel(220, 267, 0, "Price is too low"); else { if (m_Entry.Category != null) { int rank = 1; foreach (AdvertEntry ent in m_Entry.Category.Entries) { if (ent.Price < m_Entry.Price) break; rank++; } AddLabel(220, 267, 0, rank.ToString()); } else AddLabel(220, 267, 0, "No category selected"); } AddButton(271, 307, 247, 248, 1, GumpButtonType.Reply, 0); AddButton(78, 310, 241, 242, 0, GumpButtonType.Reply, 0); }
public AdvertCategoriesGump() : base(true) { int cats = AdvertSystem.Categories.Length; AddBackground(0, 0, 400, 300 + cats * 20, 3500); AddBackground(100, 20, 200, 50, 9350); AddHtml(0, 25, 400, 20, Center("Advertisement System"), false, false); AddHtml(0, 45, 400, 20, Center("Choose your category"), false, false); AddLabel(69, 98, 0, "Categories:"); AddLabel(296, 98, 0, "Entries:"); for (int i = 0; i < cats; i++) { Category cat = AdvertSystem.Categories[i]; AddButton(30, 120 + i * 25, 4005, 4006, 100 + i, GumpButtonType.Reply, 0); AddLabel(69, 120 + i * 25, 0, cat.Name); AddLabel(300, 120 + i * 25, 0, cat.Entries.Count.ToString()); } List<Category> list = new List<Category>(); foreach (Category cat in AdvertSystem.Categories) if (cat.Entries.Count > 0) list.Add(cat); if (list.Count > 0) { Category cat = list[Utility.Random(list.Count)]; m_Entry = cat.Entries[Utility.Random(cat.Entries.Count)]; AddButton(32, 245, 4005, 4006, 1, GumpButtonType.Reply, 0); AddBackground(68, 246, 275, 100, 9350); AddLabel(80, 252, 0, m_Entry.Vendor.Name); AddHtml(79, 273, 253, 65, Colorize(m_Entry.Description, "333333"), false, true); } }
public InternalTarget(AdvertEntry entry) : base(18, false, TargetFlags.None) { m_Entry = entry; }
private void HandleError(Exception e, AdvertEntry entry, AdvertJob job) { _logger.LogWarning(new EventId(), $"Grabber {job.SourceType} task {job.Id} failed: {e.Message}"); entry.RunningJobsCount--; }
public void AddGrabber(string name, IAdvertGrabber grabber) { _grabberEntries[name] = new AdvertEntry { Grabber = grabber }; }