コード例 #1
0
        private void PortForwardingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InformationDisplay DebugScreen = new InformationDisplay {
                DebugFunction = 5
            };

            DebugScreen.Show();
        }
コード例 #2
0
        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>();
        }
コード例 #3
0
        public static void WhatUnlockedThis()
        {
            var    Requirements = Tools.FindRequirements(Tools.CurrentSelectedItem, LogicObjects.MainTrackerInstance.Logic).ResolvedRealItems;
            var    FakeItems    = Tools.FindRequirements(Tools.CurrentSelectedItem, LogicObjects.MainTrackerInstance.Logic).FakeItems;
            var    Playthrough  = Tools.FindRequirements(Tools.CurrentSelectedItem, LogicObjects.MainTrackerInstance.Logic).playthrough;
            var    ItemsUsed    = Tools.FindRequirements(Tools.CurrentSelectedItem, LogicObjects.MainTrackerInstance.Logic).UsedItems;
            string message      = "Logic Entries used:\n";

            if (Requirements.Count == 0)
            {
                MessageBox.Show("Nothing is needed to check this location.", Tools.CurrentSelectedItem.LocationName + " Was Unlocked with:");
                return;
            }
            foreach (var i in ItemsUsed)
            {
                message = message + (LogicObjects.MainTrackerInstance.Logic[i].ItemName ?? LogicObjects.MainTrackerInstance.Logic[i].DictionaryName) + "\n";
            }
            message = message + "\nReal items used:\n";
            foreach (var i in Requirements)
            {
                message = message + LogicObjects.MainTrackerInstance.Logic[i].ItemName + "\n";
            }
            message = message + "\nFake Items Breakdown:\n";
            foreach (var i in FakeItems.OrderBy(x => LogicObjects.MainTrackerInstance.Logic[x].DictionaryName))
            {
                var ItemInPlaythrough = Playthrough.Find(x => x.Check.ID == i) ?? new LogicObjects.PlaythroughItem {
                    ItemsUsed = new List <int>()
                };
                message = message + LogicObjects.MainTrackerInstance.Logic[i].DictionaryName + "\n";
                message = message + WhatUnlockedThisDetailed(i, "", Playthrough, ItemInPlaythrough.ItemsUsed);
            }
            InformationDisplay Display = new InformationDisplay();

            Display.Text = Tools.CurrentSelectedItem.LocationName + " Was Unlocked with:";
            InformationDisplay.Playthrough = message.Split(new[] { "\n" }, StringSplitOptions.None).ToList();
            Display.DebugFunction          = 4;
            Display.Show();
            Tools.CurrentSelectedItem = new LogicObjects.LogicEntry();
        }
コード例 #4
0
        public static void GeneratePlaythrough(LogicObjects.TrackerInstance Instance)
        {
            List <LogicObjects.PlaythroughItem> Playthrough = new List <LogicObjects.PlaythroughItem>();
            Dictionary <int, int> SpoilerToID = new Dictionary <int, int>();
            var playLogic = Utility.CloneTrackerInstance(Instance);
            var GameClear = GetGameClearEntry(playLogic.Logic, Instance.EntranceRando);

            if (GameClear < 0)
            {
                MessageBox.Show("Could not find game clear requirements. Playthrough can not be generated."); return;
            }

            if (!Utility.CheckforSpoilerLog(playLogic.Logic))
            {
                var file = Utility.FileSelect("Select A Spoiler Log", "Spoiler Log (*.txt;*html)|*.txt;*html");
                if (file == "")
                {
                    return;
                }
                LogicEditing.WriteSpoilerLogToLogic(playLogic, file);
            }

            if (!Utility.CheckforSpoilerLog(playLogic.Logic, true))
            {
                MessageBox.Show("Not all items have spoiler data. Playthrough may not generate correctly. Ensure you are using the same version of logic used to generate your selected spoiler log");
            }

            List <int> importantItems = new List <int>();

            foreach (var i in playLogic.Logic)
            {
                i.Available = false;
                i.Checked   = false;
                i.Aquired   = false;
                if (i.IsFake)
                {
                    i.SpoilerRandom = i.ID; i.RandomizedItem = i.ID; i.LocationName = i.DictionaryName; i.ItemName = i.DictionaryName;
                }
                if (i.Unrandomized() && i.ID == i.SpoilerRandom)
                {
                    i.IsFake = true;
                }
                if (i.SpoilerRandom > -1)
                {
                    i.RandomizedItem = i.SpoilerRandom;
                }
                SpoilerToID.Add(i.SpoilerRandom, i.ID);
                //Check for all items mentioned in the logic file
                if (i.Required != null)
                {
                    foreach (var k in i.Required)
                    {
                        if (!importantItems.Contains(k))
                        {
                            importantItems.Add(k);
                        }
                    }
                }
                if (i.Conditionals != null)
                {
                    foreach (var j in i.Conditionals)
                    {
                        foreach (var k in j)
                        {
                            if (!importantItems.Contains(k))
                            {
                                importantItems.Add(k);
                            }
                        }
                    }
                }
                if (i.ID == GameClear)
                {
                    importantItems.Add(i.ID);
                }
            }

            SwapAreaClearLogic(playLogic);
            MarkAreaClearAsEntry(playLogic);
            CalculatePlaythrough(playLogic.Logic, Playthrough, 0, importantItems);


            importantItems = new List <int>();
            bool MajoraReachable          = false;
            var  GameClearPlaythroughItem = new LogicObjects.PlaythroughItem();

            foreach (var i in Playthrough)
            {
                if (i.Check.ID == GameClear)
                {
                    GameClearPlaythroughItem = i;
                    importantItems.Add(i.Check.ID);
                    FindImportantItems(i, importantItems, Playthrough, SpoilerToID);
                    MajoraReachable = true;
                    break;
                }
            }
            if (!MajoraReachable)
            {
                MessageBox.Show("This seed is not beatable using this logic! Playthrough could not be generated!"); return;
            }

            Playthrough = Playthrough.OrderBy(x => x.SphereNumber).ThenBy(x => x.Check.ItemSubType).ThenBy(x => x.Check.LocationArea).ThenBy(x => x.Check.LocationName).ToList();

            //Replace all fake items with the real items used to unlock those fake items
            foreach (var i in Playthrough)
            {
                i.ItemsUsed = Tools.ResolveFakeToRealItems(i, Playthrough, playLogic.Logic).Distinct().ToList();
            }

            List <string> PlaythroughString = new List <string>();
            int           lastSphere        = -1;

            foreach (var i in Playthrough)
            {
                if (!importantItems.Contains(i.Check.ID) || i.Check.IsFake)
                {
                    continue;
                }
                if (i.SphereNumber != lastSphere)
                {
                    PlaythroughString.Add("Sphere: " + i.SphereNumber + " ====================================="); lastSphere = i.SphereNumber;
                }
                PlaythroughString.Add("Check \"" + i.Check.LocationName + "\" to obtain \"" + playLogic.Logic[i.Check.RandomizedItem].ItemName + "\"");
                string items = "    Using Items: ";
                foreach (var j in i.ItemsUsed)
                {
                    items = items + playLogic.Logic[j].ItemName + ", ";
                }
                if (items != "    Using Items: ")
                {
                    PlaythroughString.Add(items);
                }
            }

            var h = GameClearPlaythroughItem;

            PlaythroughString.Add("Sphere: " + h.SphereNumber + " ====================================="); lastSphere = h.SphereNumber;
            PlaythroughString.Add("Defeat Majora");
            string items2 = "    Using Items: ";

            foreach (var j in h.ItemsUsed)
            {
                items2 = items2 + playLogic.Logic[j].ItemName + ", ";
            }
            if (items2 != "    Using Items: ")
            {
                PlaythroughString.Add(items2);
            }

            InformationDisplay DisplayPlaythrough = new InformationDisplay();

            InformationDisplay.Playthrough   = PlaythroughString;
            DisplayPlaythrough.DebugFunction = 3;
            DisplayPlaythrough.Show();
            InformationDisplay.Playthrough = new List <string>();
        }