Example #1
0
        private void UpdateSaints(IEnumerable <Saint> saints)
        {
            var party     = LiveDataService.ReadParty().ToList();
            var saintList = saints.ToList();

            if (saintList.Any())
            {
                var sb = new StringBuilder();
                foreach (var saint in saintList)
                {
                    sb.AppendLine(saint.Clue);
                    var alreadyKnown = (from c in party
                                        where c.HasSaint(saint.Id)
                                        select c.ShortName).ToList();

                    if (alreadyKnown.Any())
                    {
                        sb.AppendLine("Known by: " + string.Join(", ", alreadyKnown) + ".");
                    }

                    sb.AppendLine();
                }
                Messages = sb.ToString();
            }
        }
Example #2
0
        private void UpdateFormulae(IEnumerable <Formula> formulae)
        {
            var formulaList = formulae.ToList();

            if (_currentScreen == ScreenType.Alchemist &&
                formulaList.Count == 4)    // ackward hack #1
            {
                // #1 when entring the the alchemy screen memory section contains
                // 3 last formulaList and text 'potions'. Skip that.
                var party = LiveDataService.ReadParty().ToList();


                var sb = new StringBuilder();
                foreach (var f in formulaList)
                {
                    var formula = f;

                    var ingredientsWithNames =
                        from ing in formula.Ingrediens
                        let item = StaticDataService.ItemDefinitions.FirstOrDefault(i => i.Id == ing.ItemCode)
                                   select string.Format("{0} ({1})", (item != null ? item.ShortName : "???"), ing.Quantity);

                    var alreadyKnown = (from c in party
                                        where c.HasFormula(formula.Id)
                                        select c.ShortName).ToList();

                    sb.AppendLine(f.FullName + " (" + f.Quality + ") " +
                                  (alreadyKnown.Any() ? string.Join(", ", alreadyKnown) : string.Empty));
                    sb.AppendLine(string.Join(", ", ingredientsWithNames));

                    sb.AppendLine(f.Description);
                    sb.AppendLine();
                }

                Messages = sb.ToString();
            }
        }
Example #3
0
        private void UpdateResults()
        {
            var sb = new StringBuilder();

            if (string.IsNullOrEmpty(Filter))
            {
                sb.AppendLine(DefaultText);
            }
            else if (Filter.ToLower().StartsWith("help"))
            {
                sb.AppendLine(_helpText);
            }
            else
            {
                var buffFilter = SaintBuffManager.FindFilter(Filter);
                if (buffFilter == null)
                {
                    return;
                }

                var party = LiveDataService.ReadParty().ToList();

                IEnumerable <int> knownSaintIds = null;
                if (KnownOnly)
                {
                    knownSaintIds = (from c in party
                                     select c.SaintBitmask.SaintIds).SelectMany(s => s).Distinct();
                }

                var matchingSaints = StaticDataService.FilterSaints(buffFilter, knownSaintIds).ToList();
                if (matchingSaints.Any())
                {
                    sb.AppendLine("Known saints with bonus to '" + buffFilter.Name + "': ");
                    sb.AppendLine();

                    foreach (var s in matchingSaints)
                    {
                        var saint = s;

                        sb.AppendFormat("{0}: {1}", saint.ShortName, saint.GetBuff(buffFilter.Name));

                        var knownBy = (from c in party
                                       where c.SaintBitmask.HasSaint(saint.Id)
                                       select c.ShortName).ToList();

                        if (knownBy.Any())
                        {
                            sb.AppendFormat(" ({0})", string.Join(", ", knownBy));
                        }

                        sb.AppendLine();
                    }
                }
                else
                {
                    sb.AppendLine("No one in the party knows saints with buff to '" + buffFilter.Name + "'.");
                }
            }

            if (sb.Length > 0)
            {
                Result = sb.ToString();
            }
        }