예제 #1
0
        private void OnNewLogEvents(object sender, NewLogEntriesEventArgs e)
        {
            Logger.LogDebug("events received", this);
            foreach (var container in e.Entries.AllEntries)
            {
                if (container.LogType == GameLogTypes.Event)
                {
                    foreach (string line in container.Entries)
                    {
                        try
                        {
                            //detect server travel and update information
                            if (line.Contains("You are on"))
                            {
                                string serverName;
                                ServerInfo.ServerGroup group = WurmLogSearcherAPI.GetServerGroupFromLine(line, out serverName);
                                if (group != ServerInfo.ServerGroup.Unknown)
                                {
                                    if (!String.IsNullOrEmpty(serverName)) Settings.Value.GroupToServerMap[group] = serverName;
                                    CurrentServerGroup = group;
                                    currentServerGroupFound = true;
                                    Settings.Value.LastServerGroupCheckup = DateTime.Now;
                                    Settings.Value.CurrentServerName = serverName;

                                    // this is now handled via WurmState.WurmServer event
                                    //foreach (var timer in WurmTimers)
                                    //{
                                    //    if (timer.TargetServerGroup == group)
                                    //        timer.HandleServerChange();
                                    //}

                                    Settings.DelayedSave();
                                }
                            }
                        }
                        catch (Exception _e)
                        {
                            Logger.LogError("problem parsing line while updating current server group, line: " + line, this, _e);
                        }
                    }

                    foreach (var timer in WurmTimers)
                    {
                        if (timer.InitCompleted && CurrentServerGroup == timer.TargetServerGroup)
                        {
                            foreach (string line in container.Entries)
                            {
                                timer.HandleNewEventLogLine(line);
                            }
                        }
                    }
                }
                else if (container.LogType == GameLogTypes.Skills)
                {
                    //call all timers with wurmskill handler
                    foreach (var timer in WurmTimers)
                    {
                        if (timer.InitCompleted && CurrentServerGroup == timer.TargetServerGroup)
                        {
                            foreach (string line in container.Entries)
                            {
                                timer.HandleNewSkillLogLine(line);
                            }
                        }
                    }
                }
            }

            foreach (var timer in WurmTimers)
            {
                if (timer.InitCompleted && CurrentServerGroup == timer.TargetServerGroup)
                {
                    foreach (var container in e.Entries.AllEntries)
                    {
                        timer.HandleAnyLogLine(container);
                    }
                }
            }
        }
예제 #2
0
 private void OnNewLogEvents(object sender, NewLogEntriesEventArgs e)
 {
     if (e.Entries.PlayerName == PlayerName)
     {
         foreach (var container in e.Entries.AllEntries)
         {
             if (container.LogType == GameLogTypes.Event)
             {
                 foreach (var entry in container.Entries)
                 {
                     //SGManager.UpdateCurrentGroupIfNeeded(entry);
                     if (_parentModule.Settings.Value.LogCaptureEnabled)
                     {
                         HorseUpdateManager.ProcessEventForHorseUpdates(entry);
                     }
                 }
             }
             else if (container.LogType == GameLogTypes.Skills)
             {
                 foreach (var entry in container.Entries)
                 {
                     if (entry.StartsWith("Animal husbandry increased", StringComparison.Ordinal))
                     {
                         UpdateSkill(GeneralHelper.ExtractSkillLEVELFromLine(entry));
                     }
                     else if (entry.StartsWith("Animal husbandry decreased", StringComparison.Ordinal))
                     {
                         UpdateSkill(GeneralHelper.ExtractSkillLEVELFromLine(entry));
                     }
                 }
             }
         }
     }
 }
예제 #3
0
 private void OnNewLogEvents(object sender, NewLogEntriesEventArgs e)
 {
     if (e.Entries.PlayerName == this.Player)
     {
         foreach (var entry in e.Entries.AllEntries)
         {
             HandleNewLogEvents(entry.Entries, entry.LogType);
         }
     }
 }
예제 #4
0
 protected virtual void OnNewLogEntries(NewLogEntriesEventArgs e)
 {
     var eh = NewLogEntries;
     if (eh != null)
     {
         eh(this, e);
     }
 }
예제 #5
0
 void HandleLogEvents(object sender, NewLogEntriesEventArgs e)
 {
     if (e.Entries.PlayerName == PlayerName)
     {
         foreach (var container in e.Entries.AllEntries)
         {
             if (container.LogType == GameLogTypes.Event)
             {
                 foreach (var entry in container.Entries)
                 {
                     ProcessLogLine(entry, true);
                 }
             }
         }
     }
 }