Beispiel #1
0
 /// <summary>
 /// Builds the bot set.
 /// </summary>
 /// <returns></returns>
 static SetCollection<int> BuildBotSet()
 {
     SetCollection<int> result = new SetCollection<int>();
     string fileName = BotsDataBaseFile;
     if (File.Exists(fileName))
     {
         using (Stream xmlFile = new FileStream(fileName, FileMode.Open, FileAccess.Read))
         {
             XPathNavigator xml = new XPathDocument(xmlFile).CreateNavigator();
             XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xml.NameTable);
             namespaceManager.AddNamespace("bugx", "http://www.wavenet.be/bugx/web/bots.xsd");
             foreach (XPathNavigator node in xml.Select("/bugx:bots/bugx:bot", namespaceManager))
             {
                 result.Add(node.Value.GetHashCode());
             }
         }
     }
     return result;
 }
Beispiel #2
0
 public void AddItemLinkFoundEvent(ItemLinkFoundEventArgs NewEvent)
 {
     m_ItemLinkCollection.Add(NewEvent);
     return;
 }
Beispiel #3
0
        /************************************************************************************/
        protected void ReadINISettings()
        {
            IniFile NewFile = new IniFile(s_strCurrentINIFilePath);

            TransferINISettings(NewFile);

            if (File.Exists(s_strSharedOverridesINIFilePath))
            {
                IniFile OverridesFile = new IniFile(s_strSharedOverridesINIFilePath);
                TransferINISettings(OverridesFile);
            }

            ApplySettings();

            /// Load the custom tell trigger list.
            try
            {
                m_aCustomChatTriggerList.Clear();
                string strInputFile = Path.Combine(Program.ConfigurationFolderPath, m_strCustomTellTriggerFile);

                if (!File.Exists(strInputFile))
                {
                    File.WriteAllText(strInputFile, Resources.CustomTriggersTextFile, Encoding.UTF8);
                }

                using (CsvFileReader ThisReader = new CsvFileReader(strInputFile))
                {
                    SetCollection <string> CommandingPlayerSet = new SetCollection <string>();
                    CommandingPlayerSet.Add(m_astrCommandingPlayers);

                    while (ThisReader.ReadLine())
                    {
                        CustomChatTrigger NewTrigger = new CustomChatTrigger();

                        string strSourcePlayers = ThisReader.ReadNextValue().ToLower();
                        NewTrigger.m_strSubstring = ThisReader.ReadNextValue().Trim().ToLower();

                        /// An exclamation point means all configured commanding players.
                        if (strSourcePlayers == "!")
                        {
                            NewTrigger.m_SourcePlayerSet = CommandingPlayerSet;
                        }
                        else
                        {
                            NewTrigger.m_SourcePlayerSet.Add(strSourcePlayers.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries));
                        }

                        /// Keep reading commands until there are no more.
                        try
                        {
                            while (true)
                            {
                                NewTrigger.m_astrCommands.Add(ThisReader.ReadNextValue());
                            }
                        }
                        catch (IndexOutOfRangeException)
                        {
                            /// This exception is harmless and expected (though cheesy).
                        }

                        if (!string.IsNullOrEmpty(NewTrigger.m_strSubstring) && (NewTrigger.m_astrCommands.Count > 0))
                        {
                            m_aCustomChatTriggerList.Add(NewTrigger);
                            Program.DebugLog("Chat Trigger Sources: \"{0}\", Substring: \"{1}\", Commands: \"{2}\"",
                                             NewTrigger.m_SourcePlayerSet,
                                             NewTrigger.m_strSubstring,
                                             string.Join("\", \"", NewTrigger.m_astrCommands.ToArray()));
                        }
                    }
                }

                Program.DebugLog("{0} custom chat trigger(s) loaded.", m_aCustomChatTriggerList.Count);
                Program.s_EmailQueueThread.PostNewProfileMessage(m_EmailProfile);
            }
            catch
            {
                Program.Log("Generic exception while parsing custom tell trigger file. List will be cleared and unused.");
                m_aCustomChatTriggerList.Clear();
            }

            /// Load the custom regen item list.
            try
            {
                m_aCustomRegenItemList.Clear();
                string strInputFile = Path.Combine(Program.ConfigurationFolderPath, m_strCustomRegenItemFile);

                if (!File.Exists(strInputFile))
                {
                    File.WriteAllText(strInputFile, Resources.CustomRegenItemsTextFile, Encoding.UTF8);
                }

                using (CsvFileReader ThisReader = new CsvFileReader(strInputFile))
                {
                    while (ThisReader.ReadLine())
                    {
                        CustomRegenItem NewItem = new CustomRegenItem();
                        NewItem.m_strName                     = ThisReader.ReadNextValue();
                        NewItem.m_bMustBeEquipped             = bool.Parse(ThisReader.ReadNextValue());
                        NewItem.m_bMustNotBeEquipped          = bool.Parse(ThisReader.ReadNextValue());
                        NewItem.m_bMustTargetEnemy            = bool.Parse(ThisReader.ReadNextValue());
                        NewItem.m_bMustTargetFriend           = bool.Parse(ThisReader.ReadNextValue());
                        NewItem.m_fMinimumHealthRatioRequired = double.Parse(ThisReader.ReadNextValue());
                        NewItem.m_fMaximumHealthRatioRequired = double.Parse(ThisReader.ReadNextValue());
                        NewItem.m_fMinimumPowerRatioRequired  = double.Parse(ThisReader.ReadNextValue());
                        NewItem.m_fMaximumPowerRatioRequired  = double.Parse(ThisReader.ReadNextValue());

                        if (NewItem.IsValid())
                        {
                            m_aCustomRegenItemList.Add(NewItem);
                        }
                    }
                }

                Program.DebugLog("{0} custom regen item(s) loaded.", m_aCustomRegenItemList.Count);
            }
            catch
            {
                Program.Log("Generic exception while parsing custom regen item file. List will be cleared and unused.");
                m_aCustomChatTriggerList.Clear();
            }

            return;
        }