Exemplo n.º 1
0
        //Button

        private void BtnLoad_Click(object sender, EventArgs e)
        {
            if (!PromptSave())
            {
                return;
            }
            string file = Utility.FileSelect("Select A Logic File", "Logic File (*.txt;*.MMRTSET)|*.txt;*.MMRTSET");

            if (file == "")
            {
                return;
            }
            GoBackList = new List <int>();
            bool SettingsFile = file.EndsWith(".MMRTSET");
            var  lines        = (SettingsFile) ? File.ReadAllLines(file).Skip(2) : File.ReadAllLines(file);

            EditorInstance = new LogicObjects.TrackerInstance();
            EditorInstance.RawLogicFile = lines.ToArray();
            LogicEditing.PopulateTrackerInstance(EditorInstance);

            AssignUniqueItemnames(EditorInstance.Logic);
            if (EditorInstance.Logic.Count < Convert.ToInt32(nudIndex.Value))
            {
                nudIndex.Value = EditorInstance.Logic.Count - 1;
            }
            FormatForm(Convert.ToInt32(nudIndex.Value));
        }
Exemplo n.º 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;
                    }
                }
            }
        }
Exemplo n.º 3
0
        public static void CreateDictionary()
        {
            string file = Utility.FileSelect("Select A Logic File", "Logic File (*.txt)|*.txt");

            if (file == "")
            {
                return;
            }

            LogicObjects.TrackerInstance CDLogic = new LogicObjects.TrackerInstance();
            int LogicVersion = VersionHandeling.GetVersionFromLogicFile(File.ReadAllLines(file)).Version;

            LogicEditing.PopulateTrackerInstance(CDLogic);

            List <LogicObjects.SpoilerData> SpoilerLog = Tools.ReadHTMLSpoilerLog("", CDLogic);

            if (SpoilerLog.Count == 0)
            {
                return;
            }

            //For each entry in your logic list, check each entry in your spoiler log to find the rest of the data
            foreach (LogicObjects.LogicEntry entry in CDLogic.Logic)
            {
                foreach (LogicObjects.SpoilerData spoiler in SpoilerLog)
                {
                    if (spoiler.LocationID == entry.ID)
                    {
                        entry.IsFake          = false;
                        entry.LocationName    = spoiler.LocationName;
                        entry.SpoilerLocation = spoiler.LocationName;
                        entry.LocationArea    = spoiler.LocationArea;
                        entry.ItemSubType     = "Item";
                        if (entry.DictionaryName.Contains("Bottle:"))
                        {
                            entry.ItemSubType = "Bottle";
                        }
                        if (entry.DictionaryName.StartsWith("Entrance"))
                        {
                            entry.ItemSubType = "Entrance";
                        }

                        if (!CDLogic.EntranceRando)
                        {
                            if (entry.DictionaryName == "Woodfall Temple access")
                            {
                                entry.LocationArea = "Dungeon Entrance"; entry.ItemSubType = "Dungeon Entrance";
                            }
                            if (entry.DictionaryName == "Snowhead Temple access")
                            {
                                entry.LocationArea = "Dungeon Entrance"; entry.ItemSubType = "Dungeon Entrance";
                            }
                            if (entry.DictionaryName == "Great Bay Temple access")
                            {
                                entry.LocationArea = "Dungeon Entrance"; entry.ItemSubType = "Dungeon Entrance";
                            }
                            if (entry.DictionaryName == "Inverted Stone Tower Temple access")
                            {
                                entry.LocationArea = "Dungeon Entrance"; entry.ItemSubType = "Dungeon Entrance";
                            }
                        } //Dungeon Entrance Rando is dumb
                    }
                    if (spoiler.ItemID == entry.ID)
                    {
                        entry.IsFake      = false; //Not necessary, might cause problem but also might fix them ¯\_(ツ)_/¯
                        entry.ItemName    = spoiler.ItemName;
                        entry.SpoilerItem = spoiler.ItemName;
                    }
                }
            }

            List <string> csv = new List <string> {
                "DictionaryName,LocationName,ItemName,LocationArea,ItemSubType,SpoilerLocation,SpoilerItem"
            };

            //Write this data to list of strings formated as lines of csv and write that to a text file
            foreach (LogicObjects.LogicEntry entry in CDLogic.Logic)
            {
                if (!entry.IsFake)
                {
                    csv.Add(string.Format("{0},{1},{2},{3},{4},{5},{6}",
                                          entry.DictionaryName, entry.LocationName, entry.ItemName, entry.LocationArea,
                                          entry.ItemSubType, entry.SpoilerLocation, entry.SpoilerItem));
                }
            }

            SaveFileDialog saveDic = new SaveFileDialog
            {
                Filter   = "CSV File (*.csv)|*.csv",
                Title    = "Save Dictionary File",
                FileName = "MMRDICTIONARYV" + LogicVersion + ".csv"
            };

            saveDic.ShowDialog();
            File.WriteAllLines(saveDic.FileName, csv);
        }