/// <summary> /// Gets the available maps for the currently selected item given a specified race, part, and type /// </summary> private void TypeComboBoxChanged() { string type; if (selectedCategory.Equals(Strings.Mounts)) { bool isDemiHuman = selectedItem.PrimaryMTRLFolder.Contains("demihuman"); if (isDemiHuman) { type = Info.slotAbr[selectedType.Name]; } else { type = selectedType.Name; } } else { type = selectedType.Name; } var info = MTRL.GetMTRLDatafromType(selectedItem, selectedRace.ID, selectedPart.Name, type, imcVersion, selectedCategory, "a"); mtrlData = info.Item1; MapComboBox = info.Item2; if (MapComboBox.Count > 0) { MapEnabled = true; } else { MapEnabled = false; } if (MapComboBox.Count < (currMap + 1)) { MapIndex = currMap; } else { MapIndex = 0; } }
/// <summary> /// Gets the MTRL data of the given mesh /// </summary> /// <param name="mesh">The mesh to obtain the data from</param> /// <returns>The MTRLData of the given mesh</returns> public MTRLData MTRL3D(int mesh) { MTRLData mtrlData = null; bool isDemiHuman = false; if (selectedItem.PrimaryMTRLFolder != null) { isDemiHuman = selectedItem.PrimaryMTRLFolder.Contains("demihuman"); } var itemVersion = IMC.GetVersion(selectedCategory, selectedItem, false).Item1; var itemType = Helper.GetCategoryType(selectedCategory); try { if (selectedItem.ItemName.Equals(Strings.Face) || selectedItem.ItemName.Equals(Strings.Hair) || isDemiHuman) { string slotAbr; if (isDemiHuman) { slotAbr = Info.slotAbr[SelectedPart.Name]; } else if (selectedCategory.Equals(Strings.Character)) { var race = materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("c") + 1, 4); if (materialStrings[mesh].Contains("h00")) { var hairNum = materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("h00") + 1, 4); var mtrlFolder = string.Format(Strings.HairMtrlFolder, race, hairNum); slotAbr = materialStrings[mesh].Substring(materialStrings[mesh].LastIndexOf("_") - 3, 3); slotAbr = Info.HairTypes.FirstOrDefault(x => x.Value == slotAbr).Key; var hairInfo = MTRL.GetMTRLDatafromType(selectedItem, SelectedRace, hairNum, slotAbr, itemVersion, selectedCategory); return(hairInfo.Item1); } else if (materialStrings[mesh].Contains("f00")) { var faceNum = materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("f00") + 1, 4); var mtrlFolder = string.Format(Strings.FaceMtrlFolder, race, faceNum); slotAbr = materialStrings[mesh].Substring(materialStrings[mesh].LastIndexOf("_") - 3, 3); slotAbr = Info.FaceTypes.FirstOrDefault(x => x.Value == slotAbr).Key; var faceInfo = MTRL.GetMTRLDatafromType(selectedItem, SelectedRace, faceNum, slotAbr, itemVersion, selectedCategory); return(faceInfo.Item1); } else { slotAbr = selectedPart.Name; } } else { slotAbr = selectedPart.Name; } var info = MTRL.GetMTRLDatafromType(selectedItem, SelectedRace, selectedPart.Name, slotAbr, itemVersion, selectedCategory); mtrlData = info.Item1; } else { Tuple <MTRLData, ObservableCollection <ComboBoxInfo> > info; if (itemType.Equals("character") || itemType.Equals("equipment")) { try { if (materialStrings[mesh].Contains("b00") || materialStrings[mesh].Contains("t00") || materialStrings[mesh].Contains("h00")) { if (materialStrings[mesh].Contains("mt_c")) { var mtrlFolder = ""; var race = materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("c") + 1, 4); if (materialStrings[mesh].Contains("b00")) { mtrlFolder = string.Format(Strings.BodyMtrlFolder, race, materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("b00") + 1, 4)); } else if (materialStrings[mesh].Contains("t00")) { mtrlFolder = string.Format(Strings.TailMtrlFolder, race, materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("t00") + 1, 4)); } else if (materialStrings[mesh].Contains("h00")) { mtrlFolder = string.Format(Strings.HairMtrlFolder, race, materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("h00") + 1, 4)); } var mtrlFile = materialStrings[mesh].Substring(1); return(MTRL.GetMTRLInfo(Helper.GetItemOffset(FFCRC.GetHash(mtrlFolder), FFCRC.GetHash(mtrlFile)), true)); } } } catch (Exception ex) { Debug.WriteLine(ex.Message); Debug.WriteLine(ex.StackTrace); } } else { info = MTRL.GetMTRLData(selectedItem, SelectedRace.ID, selectedCategory, SelectedPart.Name, itemVersion, "", "", "0000"); } if (SelectedPart.Name.Equals("Secondary")) { info = MTRL.GetMTRLData(selectedItem, SelectedRace.ID, selectedCategory, SelectedPart.Name, itemVersion, "Secondary", "", "0000"); } else { string part = "a"; string itemID = selectedItem.PrimaryModelID; if (materialStrings.Count > 1) { try { part = materialStrings[mesh].Substring(materialStrings[mesh].LastIndexOf("_") + 1, 1); itemID = materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("_") + 2, 4); } catch (Exception ex) { Debug.WriteLine(ex.Message); Debug.WriteLine(ex.StackTrace); } } if (selectedCategory.Equals(Strings.Pets)) { part = "1"; } info = MTRL.GetMTRLData(selectedItem, SelectedRace.ID, selectedCategory, part, itemVersion, "", itemID, "0000"); } if (info != null) { mtrlData = info.Item1; } else { var combo = new ComboBoxInfo() { Name = "Default", ID = materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("c") + 1, 4), IsNum = false }; if (SelectedPart.Name.Equals("-")) { info = MTRL.GetMTRLData(selectedItem, combo.ID, selectedCategory, "a", itemVersion, "", "", "0000"); } else { info = MTRL.GetMTRLData(selectedItem, combo.ID, selectedCategory, SelectedPart.Name, itemVersion, "", "", "0000"); } mtrlData = info.Item1; } } } catch (Exception ex) { Debug.WriteLine(ex.Message); Debug.WriteLine(ex.StackTrace); return(null); } return(mtrlData); }