Beispiel #1
0
        public static void CreateTrackerInstance(LogicObjects.TrackerInstance Instance, string[] RawLogic)
        {
            Instance.RawLogicFile = RawLogic;
            LogicEditing.PopulateTrackerInstance(Instance);
            LogicEditing.CalculateItems(Instance);


            if (!Instance.IsMM())
            {
                DialogResult dialogResult = MessageBox.Show("This logic file was NOT created for the Majoras Mask Randomizer. While this tracker can support other games, support is very Limited. Many features will be disabled and core features might not work as intended. Do you wish to continue?", "Other Randomizer", MessageBoxButtons.YesNo);
                if (dialogResult != DialogResult.Yes)
                {
                    Instance = new LogicObjects.TrackerInstance(); return;
                }
            }
            else if (!VersionHandeling.ValidVersions.Contains(Instance.LogicVersion))
            {
                DialogResult dialogResult = MessageBox.Show("This version of logic is not supported. Only official releases of versions 1.8 and up are supported. This may result in the tracker not funtioning Correctly. If you are using an official release and are seeing this message, Please update your tracker. Do you wish to continue?", "Unsupported Version", MessageBoxButtons.YesNo);
                if (dialogResult != DialogResult.Yes)
                {
                    Instance = new LogicObjects.TrackerInstance(); return;
                }
            }
            if (File.Exists("options.txt"))
            {
                foreach (var i in File.ReadAllLines("options.txt"))
                {
                    if (i.Contains("ToolTips:0"))
                    {
                        Instance.Options.ShowEntryNameTooltip = false;
                    }
                    if (i.Contains("SeperateMarked:1"))
                    {
                        Instance.Options.MoveMarkedToBottom = true;
                    }
                    if (i.Contains("DisableEntrancesOnStartup:0"))
                    {
                        Instance.Options.UnradnomizeEntranesOnStartup = false;
                    }
                    if (i.Contains("CheckForUpdates:0"))
                    {
                        Instance.Options.CheckForUpdate = false;
                    }
                    if (i.Contains("MiddleClickFunction:1"))
                    {
                        Instance.Options.MiddleClickStarNotMark = true;
                    }
                }
            }
        }
Beispiel #2
0
 public static void ManageNetData(List <LogicObjects.NetData> Data)
 {
     foreach (var i in Data)
     {
         if (LogicObjects.MainTrackerInstance.Logic.ElementAt(i.ID) != null && !LogicObjects.MainTrackerInstance.Logic[i.ID].Checked)
         {
             if (!LogicObjects.MainTrackerInstance.Logic[i.ID].HasRandomItem(true) && LogicObjects.MainTrackerInstance.Logic[i.ID].SpoilerRandom < 0)
             {
                 LogicObjects.MainTrackerInstance.Logic[i.ID].RandomizedItem = i.RandomizedItem;
             }
             LogicEditing.CheckObject(LogicObjects.MainTrackerInstance.Logic[i.ID], LogicObjects.MainTrackerInstance);
         }
     }
     LogicEditing.CalculateItems(LogicObjects.MainTrackerInstance);
     NetDataProcessed(null, null);
 }
Beispiel #3
0
        public static List <List <LogicObjects.MapPoint> > FindLogicalEntranceConnections(LogicObjects.TrackerInstance Instance, LogicObjects.LogicEntry startinglocation)
        {
            //Result[0] = A map of all available exit from each entrance, Result[1] = A map of all available entrances from each exit as long as the result of that entrance is known.
            var result = new List <List <LogicObjects.MapPoint> > {
                new List <LogicObjects.MapPoint>(), new List <LogicObjects.MapPoint>()
            };

            var logicTemplate = new LogicObjects.TrackerInstance
            {
                Logic   = Utility.CloneLogicList(Instance.Logic),
                Options = Instance.Options
            };

            UnmarkEntrances(logicTemplate.Logic);

            AddRequirementstoClocktower(logicTemplate);

            //Add all available owl warps as valid exits from our starting point.
            foreach (LogicObjects.LogicEntry OwlEntry in Instance.Logic.Where(x => x.IsWarpSong() && x.Available))
            {
                var newEntry = new LogicObjects.MapPoint
                {
                    CurrentExit    = startinglocation.ID,
                    EntranceToTake = OwlEntry.ID,
                    ResultingExit  = OwlEntry.RandomizedItem
                };
                result[0].Add(newEntry);
                if (newEntry.ResultingExit > -1)
                {
                    result[1].Add(newEntry);
                }
            }

            //For each entrance, mark it Aquired and check what entrances (and item locations if they are included) become avalable.
            foreach (LogicObjects.LogicEntry entry in Instance.Logic.Where(x => x.RandomizedItem > -1 && x.IsEntrance() && x.Checked))
            {
                var ExitToCheck = logicTemplate.Logic[entry.RandomizedItem];
                //There are no valid exits from majoras lair. Logic uses it to make sure innaccessable exits don't lock something needed to beat the game.
                if (ExitToCheck.DictionaryName == "EntranceMajorasLairFromTheMoon")
                {
                    continue;
                }
                ExitToCheck.Aquired = true;
                LogicEditing.CalculateItems(logicTemplate);
                foreach (var dummyEntry in logicTemplate.Logic.Where(x => EntranceConnectionValid(x, ExitToCheck, logicTemplate)))
                {
                    var newEntry = new LogicObjects.MapPoint
                    {
                        CurrentExit    = ExitToCheck.ID,
                        EntranceToTake = dummyEntry.ID,
                        ResultingExit  = dummyEntry.RandomizedItem
                    };
                    result[0].Add(newEntry);
                    if (newEntry.ResultingExit > -1)
                    {
                        result[1].Add(newEntry);
                    }
                }
                UnmarkEntrances(logicTemplate.Logic);
            }
            return(result);
        }