private static void InitializeSnt(string[] saintLongNames, string[] saintShortNames)
        {
            using (var file = OpenFile(FileType.Saint))
            {
                var numSaints = file.ReadByte();
                _saints = new List <Saint>(numSaints);

                for (var i = 0; i < numSaints; i++)
                {
                    var desc = StringHelper.ConvertToString(
                        file.ReadBytes(Saint.DescriptionSize));

                    var clue  = SaintClues.GetClueById(i);
                    var buffs = SaintBuffManager.GenerateBuffsFromClue(clue);

                    _saints.Add(new Saint(
                                    i, saintLongNames[i], saintShortNames[i], desc, clue, buffs));
                }
            }
        }
Example #2
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();
            }
        }