string MakeNMMDropDownList(InputFormRef ifr, string basefilename, Dictionary <string, string> addFiles, List <Control> controls, string linktype, int num) { string filename = basefilename + linktype + ".txt"; if (addFiles.ContainsKey(linktype)) { return(addFiles[filename]); } string data = ""; if (linktype == "INDEX") { data = MakeNMMDropDownListInner(ifr.MakeList()); } else if (linktype == "PORTRAIT") { data = MakeNMMDropDownListInner(ImagePortraitForm.MakePortraitList()); } else if (linktype == "UNIT") { List <U.AddrResult> list = UnitForm.MakeUnitList(); data = MakeNMMDropDownListInner(list); } else if (linktype == "CLASS") { data = MakeNMMDropDownListInner(ClassForm.MakeClassList()); } else if (linktype == "ITEM") { data = MakeNMMDropDownListInner(ItemForm.MakeItemList()); } else if (linktype == "SONG") { data = MakeNMMDropDownListInner(SongTableForm.MakeItemList()); } else if (linktype == "COMBO") { Control c = InputFormRef.FindObject(ifr.Prefix, controls, num + "_" + linktype); if (c is ComboBox) { data = MakeNMMDropDownListInner((ComboBox)c); data = string.Join("\r\n", U.ComboBoxToStringList((ComboBox)c)); } } else if (linktype == "ATTRIBUTE") { StringBuilder sb = new StringBuilder(); sb.AppendLine("8"); for (uint n = 0; n < 8; n++) { sb.AppendLine(U.To0xHexString(n) + " " + InputFormRef.GetAttributeName(n)); } data = sb.ToString(); } else if (linktype == "WEAPON") { StringBuilder sb = new StringBuilder(); sb.AppendLine("7"); sb.AppendLine("0x0 -"); sb.AppendLine("0x1 E"); sb.AppendLine("0x31 D"); sb.AppendLine("0x71 C"); sb.AppendLine("0x121 B"); sb.AppendLine("0x181 A"); sb.AppendLine("0x251 S"); data = sb.ToString(); } else if (linktype == "FLAG") { StringBuilder sb = new StringBuilder(); sb.AppendLine("128"); string dummy; for (uint n = 0; n < 128; n++) { sb.AppendLine(U.To0xHexString(n) + " " + InputFormRef.GetFlagName(n, out dummy)); } data = sb.ToString(); } else if (linktype == "BIT") { filename = basefilename + linktype + num + ".txt"; if (addFiles.ContainsKey(linktype)) { return(addFiles[filename]); } data = MakeBitsListInner(ifr, controls, linktype, num); } if (data == "") { return("NULL"); } addFiles[filename] = data; return(filename); }
string MakeBitsListInner(InputFormRef ifr, List <Control> controls, string linktype, int num) { StringBuilder sb = new StringBuilder(); sb.AppendLine("256"); string[] bitnames = new string[] { "01", "02", "04", "08", "10", "20", "40", "80" }; string[] bits = new string[8]; for (uint n = 0; n < 8; n++) { string name = ifr.Prefix + "L_" + num + "_BIT_" + bitnames[n]; Control c = InputFormRef.FindObject(ifr.Prefix, controls, name); if (c is CheckBox) { bits[n] = c.Text; } else { bits[n] = ""; } } sb.AppendLine("0x00 None"); for (uint n = 1; n < 256; n++) { string str = ""; if ((n & 0x01) == 0x01) { str += "," + bits[0]; } if ((n & 0x02) == 0x02) { str += "," + bits[1]; } if ((n & 0x04) == 0x04) { str += "," + bits[2]; } if ((n & 0x08) == 0x08) { str += "," + bits[3]; } if ((n & 0x010) == 0x010) { str += "," + bits[4]; } if ((n & 0x020) == 0x020) { str += "," + bits[5]; } if ((n & 0x040) == 0x040) { str += "," + bits[6]; } if ((n & 0x080) == 0x080) { str += "," + bits[7]; } sb.AppendLine(U.To0xHexString(n) + " " + str.Substring(1)); } return(sb.ToString()); }