Beispiel #1
0
        private void RunStarted()
        {
            if (route.splits.Length - 1 > splitIndex)
            {
                TimeSpan tsOverall = DateTime.Now - dtRunStart;
                lblTime.Text = TimeSpanToString(tsOverall, false);
                TimeSpan ts = tsOverall - tsPrevSegments;
                route.splits[splitIndex].runSplitTime = ts.Ticks;
                UpdateLVI(splitIndex, ts);

                /*if (255 == getInt(oAreacode.GetAreaCodeMemory()))
                 *  possibleReset = true;
                 * if(possibleReset && oAreacode.GetAreaCodeMemory() == route.splits[0].id)
                 * {
                 *  //reset
                 *  ToggleTimer();
                 *  ToggleTimer();
                 * }
                 * else
                 * {
                 *  possibleReset = false;
                 * }*/
                //Check if we're at a split area
                if (oAreacode.GetAreaCodeMemory() == route.splits[splitIndex + 1].id)
                {
                    splitIndex++;
                    tsPrevSegments += ts;
                    //If final split then gameover stuff
                    if (splitIndex + 1 == route.splits.Length)
                    {
                        RunEnd();
                    }
                }
            }
        }
Beispiel #2
0
        /**
         * Keeps polling for a save file, when it finds the save file it looks for the areacode
         * If it's the correct areacode, i.e. if it's the first split it triggers the timer
         * This is the only time we update due to areacode in file.
         * We were updating all splits based on file, however this caused issues when
         * LBA was attempting to save the save file and we were attempting to copy it to query
         * which led to the save file not being actually saved and thus the split never changing
         *
         * On finding first split we log DateTime.Now, set the started run flag to true, and set the current run time to 0
         */
        private void RunNotStarted()
        {
            string filePath = null;

            if (!tmrInterval.Enabled)
            {
                return;
            }
            //Keep polling until we have a file
            if (null == oAreacode)
            {
                filePath = CheckNewLBAFileInDir(new Options().LBADir);
                if (null == filePath)
                {
                    return;
                }
                saveFilePath = filePath;
            }
            splitIndex = 0;
            //Check for no splits configured
            if (0 == route.splits.Length)
            {
                ToggleTimer();
                return;
            }
            oAreacode = new AreaCode(saveFilePath);
            //We should have a file
            if (oAreacode.GetAreaCodeMemory() == route.splits[splitIndex].id)
            {
                startedRun = true;
                System.Threading.Thread.Sleep(getInt(new Options().startTimeDelay));
                dtRunStart = DateTime.Now;
                if (new Options().disableAutoZoom)
                {
                    new Mem().WriteVal(0xE0A, 0, 1);
                }
                if (new Options().defaultInventorySquare)
                {
                    new Mem().WriteVal(0x12F4, 27, 1);
                }
                lblTime.Text = TimeSpanToString(dtRunStart - DateTime.Now, true);
            }
        }