Exemple #1
0
        public MiningRatioForm()
        {
            InitializeComponent();

            player = new Player();
            playerName.Text = player.PlayerName;
            wurmFolder.Text = player.WurmDir;

            numberFormat = new NumberFormatInfo();
            numberFormat.CurrencyDecimalSeparator = ".";

            loadMessageParsers();

            try {
                Start();
            } catch (Exception e) {
                MessageBox.Show(e.Message);
            }
        }
Exemple #2
0
 public SkillsWatcher(Player player)
 {
     player_ = player;
     Path = player.DumpsDir;
     Filter = "skills.*.txt";
 }
Exemple #3
0
 public LogParser(Player player)
 {
     this.player = player;
     this.InitializeMatchers();
 }
Exemple #4
0
        private bool LoadConfig()
        {
            String path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            String filename = path + "\\" + "WurmTimer.xml";

            if (!new FileInfo(filename).Exists)
                return false;

            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(filename);

                XPathNavigator nav = doc.CreateNavigator();

                XPathNodeIterator iter;
                iter = nav.Select("//WurmTimer/Player");
                while (iter.MoveNext())
                {
                    XmlElement element = iter.Current.UnderlyingObject as XmlElement;

                    Player player = new Player();
                    player.PlayerName = iter.Current.Evaluate("string(@name)") as String;
                    player.WurmDir = iter.Current.Evaluate("string(@wurmdir)") as String;
                    String testServer = iter.Current.Evaluate("string(@testserver)") as String;
                    player.TestServer = bool.TrueString.Equals(testServer, StringComparison.InvariantCultureIgnoreCase);

                    System.Diagnostics.Debug.WriteLine(String.Format("Configured player {0} in {1}", player.PlayerName, player.WurmDir));
                    this.players.Add(player);
                }
            }
            catch (Exception e)
            {
                this.players.Clear();
                System.Diagnostics.Debug.WriteLine(e.ToString());
                return false;
            }

            return true;
        }
Exemple #5
0
        private void handleLine(Player player, String line)
        {
            String prefix = "";
            if (player != null && players.Count > 1)
                prefix = player.PlayerName + ": ";

            if (Regex.IsMatch(line, "Alignment increased by"))
                startTimer(new TimeSpan(0, 30, 0), prefix + "Alignment gain");
            else if (Regex.IsMatch(line, "Faith increased by"))
                startTimer(new TimeSpan(0, 20, 0), prefix + "Faith");
            else if (Regex.IsMatch(line, "Lock picking increased by"))
                startTimer(new TimeSpan(0, 10, 0), prefix + "Lock picking");
            else if (Regex.IsMatch(line, "You finish your meditation"))
                startTimer(new TimeSpan(0, 28, 0), prefix + "Short meditation");
            else if (Regex.IsMatch(line, "You feel that it will take you a while before you are ready to meditate again"))
                startTimer(new TimeSpan(3, 0, 0), prefix + "Long meditation");
            else if (Regex.IsMatch(line, "You finish this sermon"))
                startTimer(new TimeSpan(3, 0, 0), prefix + "Sermon");
            else if (Regex.IsMatch(line, "You start using the sleep bonus\\."))
                startTimer(new TimeSpan(0, 5, 0), prefix + "Sleep bonus");
        }
Exemple #6
0
        private void handleLine(Player player, String line)
        {
            System.Diagnostics.Debug.WriteLine(line);

            foreach (Entry entry in entries)
            {
                if (entry.pattern.IsMatch(line))
                {
                    SetTool(entry.tool);
                    SetLine(line);
                    break;
                }
            }
        }