Example #1
0
 public Dictionary <string, PreloadConfigLine> LoadConfig(string path)
 {
     return(LoadConfigBase(path, 3).ToDictionary(line => line[0], line =>
     {
         var preloadAlerConfigLine = new PreloadConfigLine {
             Text = line[1], Color = line.ConfigColorValueExtractor(2)
         };
         return preloadAlerConfigLine;
     }));
 }
Example #2
0
        private void CheckForPreload(string text)
        {
            if (alertStrings.ContainsKey(text))
            {
                lock (_locker)
                {
                    alerts[alertStrings[text].Text] = alertStrings[text];
                }

                return;
            }

            if (text.Contains("Metadata/Terrain/Doodads/vaal_sidearea_effects/soulcoaster.ao"))
            {
                if (Settings.CorruptedTitle)
                {
                    // using corrupted titles so set the color here, XpRatePlugin will grab the color to use when drawing the title.
                    AreaNameColor = Settings.CorruptedAreaColor;
                    GameController.Area.CurrentArea.AreaColorName = AreaNameColor;
                }
                else
                {
                    // not using corrupted titles, so throw it in a preload alert
                    lock (_locker)
                    {
                        alerts[text] = new PreloadConfigLine {
                            Text = "Corrupted Area", FastColor = () => Settings.CorruptedAreaColor
                        };
                    }
                }

                return;
            }

            if (Settings.Essence)
            {
                var essence_alert = Essences.Where(kv => text.StartsWith(kv.Key, StringComparison.OrdinalIgnoreCase)).Select(kv => kv.Value)
                                    .FirstOrDefault();

                if (essence_alert != null)
                {
                    essencefound = true;

                    if (alerts.ContainsKey("Remnant of Corruption"))

                    //TODO: TEST ESSENCE
                    {
                        lock (_locker)
                        {
                            alerts.Remove("Remnant of Corruption");
                        }
                    }

                    lock (_locker)
                    {
                        alerts[essence_alert.Text] = essence_alert;
                    }

                    return;
                }

                if (!essencefound && text.Contains("MiniMonolith"))
                {
                    lock (_locker)
                    {
                        alerts["Remnant of Corruption"] = new PreloadConfigLine
                        {
                            Text = "Remnant of Corruption", FastColor = () => Settings.RemnantOfCorruption
                        };
                    }
                }
            }

            var perandus_alert = PerandusLeague.Where(kv => text.StartsWith(kv.Key, StringComparison.OrdinalIgnoreCase))
                                 .Select(kv => kv.Value).FirstOrDefault();

            if (perandus_alert != null && Settings.PerandusBoxes)
            {
                foundSpecificPerandusChest = true;

                if (alerts.ContainsKey("Unknown Perandus Chest"))
                {
                    lock (_locker)
                    {
                        alerts.Remove("Unknown Perandus Chest");
                    }
                }

                lock (_locker)
                {
                    alerts.Add(perandus_alert.Text, perandus_alert);
                }

                return;
            }

            if (Settings.PerandusBoxes && !foundSpecificPerandusChest && text.StartsWith("Metadata/Chests/PerandusChests"))
            {
                lock (_locker)
                {
                    alerts["Unknown Perandus Chest"] = new PreloadConfigLine
                    {
                        Text = "Unknown Perandus Chest", FastColor = () => Settings.PerandusChestStandard
                    };
                }
            }

            var _alert = Strongboxes.Where(kv => text.StartsWith(kv.Key, StringComparison.OrdinalIgnoreCase)).Select(kv => kv.Value)
                         .FirstOrDefault();

            if (_alert != null && Settings.Strongboxes)
            {
                lock (_locker)
                {
                    alerts[_alert.Text] = _alert;
                }

                return;
            }

            var alert = Preload.Where(kv => text.EndsWith(kv.Key, StringComparison.OrdinalIgnoreCase)).Select(kv => kv.Value)
                        .FirstOrDefault();

            if (alert != null && Settings.Exiles)
            {
                lock (_locker)
                {
                    alerts[alert.Text] = alert;
                }
            }
        }