private void BtnEditSelected_Click(object sender, EventArgs e) { EditorInstance.UnsavedChanges = true; Tools.SaveState(EditorInstance); for (var n = 0; n < LBConditional.Items.Count; n++) { if (LBConditional.GetSelected(n)) { var temp = LBConditional.Items[n] as RequiementConditional; foreach (var j in temp.ItemIDs) { ItemSelect.CheckedItems.Add(j.ID); } ItemSelect Selector = new ItemSelect(); ItemSelect.Function = 5; Selector.ShowDialog(); if (Selector.DialogResult != DialogResult.OK) { ItemSelect.Function = 0; return; } RequiementConditional entry = new RequiementConditional { ItemIDs = new List <LogicObjects.LogicEntry>() }; string Display = ""; string addComma = ""; foreach (var i in Tools.CurrentselectedItems) { Display = Display + addComma + (i.ItemName ?? i.DictionaryName); addComma = ", "; entry.ItemIDs.Add(i); } entry.DisplayName = Display; if (Display == "") { LBConditional.Items.RemoveAt(n); } else { LBConditional.Items[n] = (entry); } Tools.CurrentselectedItems = new List <LogicObjects.LogicEntry>(); ItemSelect.Function = 0; LBConditional.Refresh(); UpdateReqAndCond(); } } }
//Functions public void WriteCurentItem(int Index) { PrintingItem = true; LBRequired.Items.Clear(); LBConditional.Items.Clear(); LogicObjects.LogicEntry entry; try { entry = EditorInstance.Logic[Index]; } catch { FormatForm(); return; } currentEntry = entry; renameCurrentItemToolStripMenuItem.Visible = currentEntry.IsFake; deleteCurrentItemToolStripMenuItem.Visible = currentEntry.IsFake; setTrickToolTipToolStripMenuItem.Visible = currentEntry.IsTrick; foreach (var i in entry.Required ?? new int[0]) { var ReqEntry = EditorInstance.Logic[i]; ReqEntry.DisplayName = ReqEntry.ItemName ?? ReqEntry.DictionaryName; ReqEntry.DisplayName = (LogicEditor.UseSpoilerInDisplay) ? (ReqEntry.SpoilerItem ?? ReqEntry.DisplayName) : ReqEntry.DisplayName; ReqEntry.DisplayName = (LogicEditor.UseDictionaryNameInSearch) ? ReqEntry.DictionaryName : ReqEntry.DisplayName; LBRequired.Items.Add(ReqEntry); } foreach (var j in entry.Conditionals ?? new int[0][]) { var CondEntry = new RequiementConditional { ItemIDs = new List <LogicObjects.LogicEntry>() }; string Display = ""; string addComma = ""; foreach (var i in j ?? new int[0]) { var ReqEntry = EditorInstance.Logic[i]; string disName = ReqEntry.ItemName ?? ReqEntry.DictionaryName; disName = (LogicEditor.UseSpoilerInDisplay) ? (ReqEntry.SpoilerItem ?? disName) : disName; disName = (LogicEditor.UseDictionaryNameInSearch) ? ReqEntry.DictionaryName : disName; Display = Display + addComma + disName; addComma = ", "; CondEntry.ItemIDs.Add(ReqEntry); } CondEntry.DisplayName = Display; LBConditional.Items.Add(CondEntry); } string DictionaryName = entry.DictionaryName.ToString(); string LocationName = entry.LocationName ?? "Fake Location"; string ItemName = entry.ItemName ?? "Fake Item"; LocationName = (UseSpoilerInDisplay) ? (entry.SpoilerLocation ?? LocationName) : LocationName; ItemName = (UseSpoilerInDisplay) ? (entry.SpoilerItem ?? ItemName) : ItemName; lblDicName.Text = DictionaryName; lblLocName.Text = LocationName.ToString(); lblItemName.Text = ItemName.ToString(); chkOnDay1.Checked = (((entry.AvailableOn >> 0) & 1) == 1); chkOnDay2.Checked = (((entry.AvailableOn >> 2) & 1) == 1); chkOnDay3.Checked = (((entry.AvailableOn >> 4) & 1) == 1); chkOnNight1.Checked = (((entry.AvailableOn >> 1) & 1) == 1); chkOnNight2.Checked = (((entry.AvailableOn >> 3) & 1) == 1); chkOnNight3.Checked = (((entry.AvailableOn >> 5) & 1) == 1); chkNeedDay1.Checked = (((entry.NeededBy >> 0) & 1) == 1); chkNeedDay2.Checked = (((entry.NeededBy >> 2) & 1) == 1); chkNeedDay3.Checked = (((entry.NeededBy >> 4) & 1) == 1); chkNeedNight1.Checked = (((entry.NeededBy >> 1) & 1) == 1); chkNeedNight2.Checked = (((entry.NeededBy >> 3) & 1) == 1); chkNeedNight3.Checked = (((entry.NeededBy >> 5) & 1) == 1); chkIsTrick.Checked = entry.IsTrick; chkIsTrick.Enabled = entry.IsFake; nudIndex.Value = currentEntry.ID; PrintingItem = false; }
private void BtnAddCond_Click(object sender, EventArgs e) { EditorInstance.UnsavedChanges = true; Tools.SaveState(EditorInstance); ItemSelect Selector = new ItemSelect(); ItemSelect.Function = 7; Selector.ShowDialog(); if (Selector.DialogResult != DialogResult.OK) { ItemSelect.Function = 0; return; } if (Tools.CurrentselectedItems.Count < 1) { ItemSelect.Function = 0; return; } if (AddCondSeperatly) { foreach (var i in Tools.CurrentselectedItems) { var entry = new RequiementConditional { DisplayName = (i.ItemName ?? i.DictionaryName), ItemIDs = new List <LogicObjects.LogicEntry> { i } }; if (LBConditional.Items.Contains(entry)) { continue; } LBConditional.Items.Add(entry); } } else { RequiementConditional entry = new RequiementConditional { ItemIDs = new List <LogicObjects.LogicEntry>() }; string Display = ""; string addComma = ""; foreach (var i in Tools.CurrentselectedItems) { Display = Display + addComma + (i.ItemName ?? i.DictionaryName); addComma = ", "; entry.ItemIDs.Add(i); } entry.DisplayName = Display; if (entry.DisplayName == "" || entry.ItemIDs.Count < 1) { return; } if (!LBConditional.Items.Contains(entry)) { LBConditional.Items.Add(entry); } } AddCondSeperatly = false; Tools.CurrentselectedItems = new List <LogicObjects.LogicEntry>(); ItemSelect.Function = 0; UpdateReqAndCond(); }