示例#1
0
        private void GameTracker_Tick(object sender, EventArgs e)
        {
            Task.Run(() =>
            {
                var span = CurrentSession.GetSessionTime();

                var newSecs = (span - _lastGameTimeSpan).TotalSeconds;
                if (newSecs > 0)
                {
                    settings.GameTime += newSecs;
                }

                _lastGameTimeSpan = span;
            });
        }
示例#2
0
 private void AccessGameTimeLabel()
 {
     try
     {
         if (settings.GameTime >= (int.MaxValue - 1))
         {
             GameTimeLabel.Text = "Game Time: >= 68 Years";
             settings.GameTime--;
         }
         var span            = TimeSpan.FromSeconds(settings.GameTime);
         var spanCurrent     = CurrentSession.GetSessionTime();
         var totalMinutes    = Math.Floor(span.TotalMinutes);
         var totalHours      = Math.Floor(span.TotalHours);
         var totalMinutesCur = Math.Floor(spanCurrent.TotalMinutes);
         var totalHoursCur   = Math.Floor(spanCurrent.TotalHours);
         if (settings.GameTime >= 1 && totalMinutes < 1)
         {
             GameTimeLabel.Text = "Game Time: " + settings.GameTime.ToString("N0") + " seconds";
         }
         if (totalMinutes >= 1 && totalHours < 1)
         {
             GameTimeLabel.Text = "Game Time: " + totalMinutes.ToString("N0") + " minutes";
         }
         if (totalHours >= 1)
         {
             GameTimeLabel.Text = "Game Time: " + totalHours.ToString("N0") + " hours";
         }
         if (spanCurrent.TotalSeconds > 0 && totalMinutesCur < 1)
         {
             CurSessionGT.Text = "Current Session: " + spanCurrent.TotalSeconds.ToString("N0") + " seconds";
         }
         if (totalMinutesCur >= 1 && totalHoursCur < 1)
         {
             CurSessionGT.Text = "Current Session: " + totalMinutesCur.ToString("N0") + " minutes";
         }
         if (totalHoursCur >= 1)
         {
             CurSessionGT.Text = "Current Session: " + totalHoursCur.ToString("N0") + " hours";
         }
     }
     catch (Exception ex)
     {
         Log.WriteLine("An exception happened while trying to get total played time!");
         Log.WriteLine(ex.ToString());
     }
 }
示例#3
0
        private void DoRAChecks() //this is where we do aspect ratio checks to ensure we limit FoV at non-widescreen values to reduce potential for any cheating
        {
            if (SelectedMemory == null || !SelectedMemory.IsRunning() || SelectedMemory.ProcMemory.RequiresElevation() || CurrentSession == null || CurrentSession.GetSessionTime().TotalSeconds < 30)
            {
                return;                                                                                                                                                                                        //if you do aspect ratio checks too soon, they'll return invalid values
            }
            try
            {
                var mode  = SelectedMemory.ReadIntAddress(MemoryAddresses.UO_R_MODE_ADDRESS, 0x20);
                var ratio = 0d;


                if (mode == -1)
                {
                    var width  = SelectedMemory.ReadIntAddress(MemoryAddresses.UO_R_WIDTH_ADDRESS, 0x20);
                    var height = SelectedMemory.ReadIntAddress(MemoryAddresses.UO_R_HEIGHT_ADDRESS, 0x20);

                    if (width <= 0 || height <= 0)
                    {
                        Log.WriteLine("Got bad width/height: " + width + ", " + height);
                        return;
                    }

                    ratio = width / (double)height;
                }


                var maxFoV = (mode != -1 || (ratio < 1.7 && mode == -1)) ? 105 : 130;

                if (FoVNumeric.InvokeRequired)
                {
                    FoVNumeric.Invoke((MethodInvoker) delegate() { FoVNumeric.Maximum = maxFoV; });
                }
                else
                {
                    FoVNumeric.Maximum = maxFoV;
                }

                SetFoVNumeric(FoVNumeric.Value); //will set it to the value if it can, if not, falls back on maximum
            }
            catch (Exception ex) { Log.WriteLine("An exception happened while trying to get current game resolution:" + Environment.NewLine + ex.ToString()); }
        }