public static List <LogicObjects.LogicEntry> ProgressiveItemSet(this LogicObjects.LogicEntry entry, LogicObjects.TrackerInstance Instance)
        {
            if (!Instance.Options.ProgressiveItems || !Instance.IsMM())
            {
                return(null);
            }
            List <List <LogicObjects.LogicEntry> > ProgressiveItemSets = Utility.GetProgressiveItemSets(Instance);
            var set = ProgressiveItemSets.Find(x => x.Contains(entry));

            return(set);
        }
示例#2
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;
                    }
                }
            }
        }
        public static void DisplayPlaythrough(List <LogicObjects.PlaythroughItem> Playthrough, LogicObjects.TrackerInstance CopyInstance, int GameclearItem, List <LogicObjects.LogicEntry> MainLogic)
        {
            List <string> PlaythroughString = new List <string>();
            int           lastSphere        = -1;

            string FinalTask = CopyInstance.Logic[GameclearItem].DictionaryName;

            if (FinalTask == "MMRTGameClear")
            {
                FinalTask = (CopyInstance.IsMM()) ? "Defeat Majora" : "Beat the game";
            }
            foreach (var i in Playthrough)
            {
                if (i.SphereNumber != lastSphere)
                {
                    PlaythroughString.Add("Sphere: " + i.SphereNumber + " ====================================="); lastSphere = i.SphereNumber;
                }
                if (i.Check.ID == GameclearItem)
                {
                    PlaythroughString.Add(FinalTask);
                }
                else
                {
                    var ObtainLine = "Check \"" + i.Check.LocationName + "\" to obtain \"" + CopyInstance.Logic[i.Check.RandomizedItem].ItemName + "\"";
                    if (MainLogic.Count() > i.Check.ID && MainLogic[i.Check.ID].Checked)
                    {
                        ObtainLine += " ✅";
                    }
                    PlaythroughString.Add(ObtainLine);
                }
                string items = "    Using Items: ";
                foreach (var j in i.ItemsUsed)
                {
                    items = items + CopyInstance.Logic[j].ItemName + ", ";
                }
                if (items != "    Using Items: ")
                {
                    PlaythroughString.Add(items);
                }
            }

            InformationDisplay DisplayPlaythrough = new InformationDisplay();

            InformationDisplay.Playthrough   = PlaythroughString;
            DisplayPlaythrough.DebugFunction = 3;
            DisplayPlaythrough.Show();
            InformationDisplay.Playthrough = new List <string>();
        }
示例#4
0
        private void SeedChecker_Load(object sender, EventArgs e)
        {
            CheckerInstance = Utility.CloneTrackerInstance(LogicObjects.MainTrackerInstance);

            if (!Utility.CheckforSpoilerLog(CheckerInstance.Logic))
            {
                var file = Utility.FileSelect("Select A Spoiler Log", "Spoiler Log (*.txt;*html)|*.txt;*html");
                if (file == "")
                {
                    return;
                }
                LogicEditing.WriteSpoilerLogToLogic(CheckerInstance, file);
                if (!Utility.CheckforSpoilerLog(CheckerInstance.Logic, true))
                {
                    MessageBox.Show("Not all items have spoiler data. Your results may be incorrect.");
                }
            }
            else if (!Utility.CheckforSpoilerLog(CheckerInstance.Logic, true))
            {
                MessageBox.Show("Not all items have spoiler data. Your results may be incorrect.");
            }


            var GameClearEntry = CheckerInstance.Logic.Find(x => x.DictionaryName == "MMRTGameClear");

            int GameclearID = -1;

            if (GameClearEntry != null)
            {
                GameClearEntry.DictionaryName = (CheckerInstance.IsMM()) ? "Defeat Majora" : "Beat the Game";
                LBNeededItems.Items.Add(new LogicObjects.ListItem {
                    DisplayName = GameClearEntry.DictionaryName, PathID = GameClearEntry.ID
                });
            }
            else if (CheckerInstance.IsMM())
            {
                Console.WriteLine("Adding MMRTGameClear");
                GameclearID = PlaythroughGenerator.GetGameClearEntry(CheckerInstance.Logic, CheckerInstance.IsEntranceRando());
                if (!CheckerInstance.ItemInRange(GameclearID))
                {
                    return;
                }
                CheckerInstance.Logic[GameclearID].DictionaryName = "Defeat Majora";
                LBNeededItems.Items.Add(new LogicObjects.ListItem {
                    DisplayName = "Defeat Majora", PathID = GameclearID
                });
            }

            listBox2.DataSource = CheckerInstance.Logic.Select(x => x.LocationName ?? x.DictionaryName).ToList();

            GameClearEntry = CheckerInstance.Logic.Find(x => x.DictionaryName == "MMRTGameClear" || x.DictionaryName == "Beat the Game" || x.DictionaryName == "Defeat Majora");

            if (GameClearEntry != null)
            {
                listBox2.SelectedIndex = GameClearEntry.ID;
            }
            else
            {
                listBox2.SelectedIndex = 0;
            }
            WriteSpoilerItemsToBox();
        }
        public static bool CanBeStartingItem(this LogicObjects.LogicEntry entry, LogicObjects.TrackerInstance Instance)
        {
            if (!Instance.IsMM())
            {
                return(true);
            }
            List <string> StartingItems = new List <string>
            {
                "Deku Mask",
                "Hero's Bow",
                "Fire Arrow",
                "Ice Arrow",
                "Light Arrow",
                "Bomb Bag",
                "Pictobox",
                "Lens of Truth",
                "Hookshot",
                "Magic Power",
                "Spin Attack",
                "Extended Magic Power",
                "Double Defense",
                "Great Fairy's Sword",
                "Bombers' Notebook",
                "Razor Sword",
                "Gilded Sword",
                "Mirror Shield",
                "Large Quiver",
                "Largest Quiver",
                "Big Bomb Bag",
                "Biggest Bomb Bag",
                "Adult Wallet",
                "Giant Wallet",
                "Postman's Hat",
                "All Night Mask",
                "Blast Mask",
                "Stone Mask",
                "Great Fairy's Mask",
                "Keaton Mask",
                "Bremen Mask",
                "Bunny Hood",
                "Don Gero's Mask",
                "Mask of Scents",
                "Romani's Mask",
                "Circus Leader's Mask",
                "Kafei's Mask",
                "Couple's Mask",
                "Mask of Truth",
                "Kamaro's Mask",
                "Gibdo Mask",
                "Garo's Mask",
                "Captain's Hat",
                "Giant's Mask",
                "Goron Mask",
                "Zora Mask",
                "Song of Healing",
                "Song of Soaring",
                "Epona's Song",
                "Song of Storms",
                "Sonata of Awakening",
                "Goron Lullaby",
                "New Wave Bossa Nova",
                "Elegy of Emptiness",
                "Oath to Order",
                "Woodfall Map",
                "Woodfall Compass",
                "Snowhead Map",
                "Snowhead Compass",
                "Great Bay Map",
                "Great Bay Compass",
                "Stone Tower Map",
                "Stone Tower Compass",
                "Map of Clock Town",
                "Map of Woodfall",
                "Map of Snowhead",
                "Map of Romani Ranch",
                "Map of Great Bay",
                "Map of Stone Tower",
                "Fierce Deity's Mask",
                "Kokiri Sword",
                "Hero's Shield"
            };

            return(StartingItems.Contains(entry.ItemName));
        }
        public static bool CheckAvailability(this LogicObjects.LogicEntry entry, LogicObjects.TrackerInstance Instance, List <int> usedItems = null)
        {
            var logic = Instance.Logic;

            usedItems = usedItems ?? new List <int>();
            if (string.IsNullOrWhiteSpace(entry.LocationName) && !entry.IsFake)
            {
                return(false);
            }

            //Check for a "Combinations" Entry
            if (entry.Required != null && entry.Conditionals != null && entry.Required.Where(x => logic[x].DictionaryName.StartsWith("MMRTCombinations")).Any())
            {
                List <int> CondItemsUsed       = new List <int>();
                int        ComboEntry          = entry.Required.ToList().Find(x => logic[x].DictionaryName.StartsWith("MMRTCombinations"));
                var        Required            = entry.Required.Where(x => !logic[x].DictionaryName.StartsWith("MMRTCombinations")).ToArray();
                int        ConditionalsAquired = 0;
                if (int.TryParse(logic[ComboEntry].DictionaryName.Replace("MMRTCombinations", ""), out int ConditionalsNeeded))
                {
                    if (!Required.Any() || LogicEditing.RequirementsMet(Required, Instance, CondItemsUsed))
                    {
                        foreach (var i in entry.Conditionals)
                        {
                            List <int> ReqItemsUsed = new List <int>();
                            if (LogicEditing.RequirementsMet(i, Instance, ReqItemsUsed))
                            {
                                foreach (var q in ReqItemsUsed)
                                {
                                    CondItemsUsed.Add(q);
                                }
                                ConditionalsAquired++;
                            }
                            if (ConditionalsAquired >= ConditionalsNeeded)
                            {
                                foreach (var q in CondItemsUsed)
                                {
                                    usedItems.Add(q);
                                }
                                return(true);
                            }
                        }
                    }
                }
                return(false);
            }
            //Check for a "Check contains Item" Entry
            else if (entry.Required != null && entry.Conditionals != null && entry.Required.Where(x => logic[x].DictionaryName == "MMRTCheckContains").Any())
            {
                var Checks = entry.Required.Where(x => logic[x].DictionaryName != "MMRTCheckContains").ToArray();
                if (!Checks.Any())
                {
                    return(false);
                }
                var entries = Math.Min(Checks.Count(), entry.Conditionals.Count());
                for (var i = 0; i < entries; i++)
                {
                    var Check = logic[entry.Required[i]].RandomizedItem;
                    var Items = entry.Conditionals[i];
                    foreach (var j in Items)
                    {
                        if (Check == j)
                        {
                            usedItems.Add(j); return(true);
                        }
                    }
                }
                return(false);
            }
            //Check for a MMR Dungeon clear Entry
            else if (Instance.IsMM() && entry.IsFake && Instance.EntranceAreaDic.Count > 0 && Instance.EntranceAreaDic.ContainsKey(entry.ID))
            {
                var RandClearLogic = entry.ClearRandomizedDungeonInThisArea(Instance);
                if (RandClearLogic == null)
                {
                    return(false);
                }
                else
                {
                    return(LogicEditing.RequirementsMet(RandClearLogic.Required, Instance, usedItems) &&
                           LogicEditing.CondtionalsMet(RandClearLogic.Conditionals, Instance, usedItems));
                }
            }
            //Check availability the standard way
            else
            {
                return(LogicEditing.RequirementsMet(entry.Required, Instance, usedItems) &&
                       LogicEditing.CondtionalsMet(entry.Conditionals, Instance, usedItems));
            }
        }
 public static string ProgressiveItemName(this LogicObjects.LogicEntry entry, LogicObjects.TrackerInstance Instance)
 {
     if (entry.IsProgressiveItem(Instance) && Instance.Options.ProgressiveItems && Instance.IsMM())
     {
         return((entry.SpoilerItem.Count() > 1) ? entry.SpoilerItem[1] : entry.ItemName ?? entry.DictionaryName);
     }
     return(entry.ItemName ?? entry.DictionaryName);
 }