/// <summary> /// Get the model for the current item and a specific character type. /// </summary> /// <param name="characterType">Character type to get the model for.</param> /// <param name="materialVersion">When this method returns contains the variant of the model for the current item.</param> /// <returns>The model for the current item and <c>characterType</c>.</returns> public ModelDefinition GetModel(int characterType, out Graphics.ImcVariant variant) { variant = Graphics.ImcVariant.Default; EquipSlot slot = EquipSlotCategory.PossibleSlots.FirstOrDefault(); return(slot == null ? null : GetModel(slot, characterType, out variant)); }
/// <summary> /// Get the model for a specific QWord, character type, and the current <see cref="EquipSlot" />. /// </summary> /// <param name="key">The identifier of the model.</param> /// <param name="characterType">Character type to get the model for.</param> /// <param name="materialVersion">When this method returns, contains the variant contained within <c>key</c>.</param> /// <returns>Returns the <see cref="Model" /> for the specified <c>key</c> and <c>characterType</c>.</returns> public ModelDefinition GetModel(Quad key, int characterType, out Graphics.ImcVariant variant) { variant = Graphics.ImcVariant.Default; ModelHelper helper; if (!ModelHelpers.TryGetValue(Key, out helper)) { return(null); } if (helper == null) { return(null); } var packs = Collection.Collection.PackCollection; var variantIndex = (int)((key.ToInt64() >> (helper.VariantIndexWord * 16)) & 0xFFFF); var imcPath = string.Format(helper.ImcFileFormat, key.Value1, key.Value2, key.Value3, key.Value4, characterType); IO.File imcBase; if (!packs.TryGetFile(imcPath, out imcBase)) { return(null); } var imc = new Graphics.ImcFile(imcBase); variant = imc.GetVariant(helper.ImcPartKey, variantIndex); IO.File modelBase = null; while (!packs.TryGetFile(string.Format(helper.ModelFileFormat, key.Value1, key.Value2, key.Value3, key.Value4, characterType), out modelBase) && CharacterTypeFallback.TryGetValue(characterType, out characterType)) { } var asModel = modelBase as Graphics.ModelFile; if (asModel == null) { return(null); } return(asModel.GetModelDefinition()); }
/// <summary> /// Get the model for the current item and a specific character type and in a speific <see cref="EquipSlot" />. /// </summary> /// <param name="equipSlot"><see cref="EquipSlot" /> for which to get the model.</param> /// <param name="characterType">Character type to get the model for.</param> /// <param name="materialVersion">When this method returns contains the variant of the model for the current item.</param> /// <returns>The model for the current item and <c>characterType</c> in <c>equipSlot</c>.</returns> public ModelDefinition GetModel(EquipSlot equipSlot, int characterType, out Graphics.ImcVariant variant) { return(equipSlot.GetModel(PrimaryModelKey, characterType, out variant)); }