|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Text; |
| 4 | +using xivModdingFramework.Models.FileTypes; |
| 5 | + |
| 6 | +namespace xivModdingFramework.Models.DataContainers |
| 7 | +{ |
| 8 | + |
| 9 | + |
| 10 | + public class EquipmentParameterSet |
| 11 | + { |
| 12 | + /// <summary> |
| 13 | + /// The actual parameters contained in this set, by Slot Abbreviation. |
| 14 | + /// Strings should match up to Mdl.SlotAbbreviationDictionary Keys |
| 15 | + /// This element should always contain 5 entries: [met, top, glv, dwn, sho] |
| 16 | + /// </summary> |
| 17 | + public Dictionary<string, EquipmentParameter> Parameters; |
| 18 | + |
| 19 | + public EquipmentParameterSet() |
| 20 | + { |
| 21 | + Parameters = new Dictionary<string, EquipmentParameter>() { |
| 22 | + { "met", new EquipmentParameter("met") }, |
| 23 | + { "top", new EquipmentParameter("top") }, |
| 24 | + { "glv", new EquipmentParameter("glv") }, |
| 25 | + { "dwn", new EquipmentParameter("dwn") }, |
| 26 | + { "sho", new EquipmentParameter("sho") } |
| 27 | + }; |
| 28 | + } |
| 29 | + public static List<string> SlotsAsList() |
| 30 | + { |
| 31 | + return new List<string>() { "met", "top", "glv", "dwn", "sho" }; |
| 32 | + } |
| 33 | + } |
| 34 | + |
| 35 | + /// <summary> |
| 36 | + /// Bitwise flags for the main equipment parameter 64 bit array. |
| 37 | + /// Flag names are set based on what they do when they are set to [1] |
| 38 | + /// </summary> |
| 39 | + public enum EquipmentParameterFlag |
| 40 | + { |
| 41 | + //Byte 0 - Body |
| 42 | + EnableBodyFlags = 0, |
| 43 | + BodyHideWaist = 1, |
| 44 | + BodyPreventArmHiding = 6, |
| 45 | + BodyPreventNeckHiding = 7, |
| 46 | + |
| 47 | + // Byte 1 - Body |
| 48 | + BodyShowLeg = 8, // When turned off, Leg hiding data is resolved from this same set, rather than the set of the equipped piece. |
| 49 | + BodyShowHand = 9, // When turned off, Hand hiding data is resolved from this same set, rather than the set of the equipped piece. |
| 50 | + BodyShowHead = 10, // When turned off, Head hiding data is resolved from this same set, rather than the set of the equipped piece. |
| 51 | + BodyShowNecklace = 11, |
| 52 | + BodyShowBracelet = 12, // "Wrist[slot]" is not used in this context b/c it can be confusing with other settings. |
| 53 | + BodyHideTail = 14, |
| 54 | + |
| 55 | + // Byte 2 - Leg |
| 56 | + EnableLegFlags = 16, |
| 57 | + LegShowFoot = 21, |
| 58 | + |
| 59 | + // Byte 3 - Hand |
| 60 | + EnableHandFlags = 24, |
| 61 | + HandHideElbow = 25, // Requires bit 26 on as well to work. |
| 62 | + HandHideForearm = 26, // "Wrist[anatomy]" is not used in this context b/c it can be confusing with other settings. |
| 63 | + HandShowBracelet = 28, // "Wrist[slot]" is not used in this context b/c it can be confusing with other settings. |
| 64 | + HandShowRingL = 29, |
| 65 | + HandShowRingR = 30, |
| 66 | + |
| 67 | + // Byte 4 - Foot |
| 68 | + EnableFootFlags = 32, |
| 69 | + FootHideKnee = 33, // Requires bit 34 on as well to work. |
| 70 | + FootHideCalf = 34, |
| 71 | + FootUsuallyOn = 35, // Usually set to [1], the remaining bits of this byte are always [0]. |
| 72 | + |
| 73 | + // Byte 5 - Head & Hair |
| 74 | + EnableHeadFlags = 40, |
| 75 | + HeadHideHairTop = 41, // When set alone, hides top(hat part) of hair. When set with 42, hides everything. |
| 76 | + HeadHideHair = 42, // When set with 41, hides everything neck up. When set without, hides all hair. |
| 77 | + HeadShowHair = 43, // Seems to override bit 42 if set? |
| 78 | + HeadHideNeck = 44, |
| 79 | + HeadShowNecklace = 45, |
| 80 | + HeadShowEarrings = 47, // This cannot be toggled off without enabling bit 42. |
| 81 | + |
| 82 | + // Byte 6 - Ears/Horns/Etc. |
| 83 | + HeadShowEarringsHuman = 48, |
| 84 | + HeadShowEarringsAura = 49, |
| 85 | + HeadShowEarHuman = 50, |
| 86 | + HeadShowEarMiqo = 51, |
| 87 | + HeadShowEarAura = 52, |
| 88 | + HeadShowEarViera = 53, |
| 89 | + HeadUnknownHelmet1 = 54, // Usually set on for helmets, in place of 48/49 |
| 90 | + HeadUnknownHelmet2 = 55, // Usually set on for helmets, in place of 48/49 |
| 91 | + |
| 92 | + // Byte 7 - Shadowbringers Race Settings |
| 93 | + EnableShbFlags = 56, |
| 94 | + ShbShowHead = 57 |
| 95 | + } |
| 96 | + |
| 97 | + |
| 98 | + /// <summary> |
| 99 | + /// Class representing an EquipmentParameter entry, |
| 100 | + /// mostly contains data relating to whether or not |
| 101 | + /// certain elements should be shown or hidden for |
| 102 | + /// this piece of gear. |
| 103 | + /// </summary> |
| 104 | + public class EquipmentParameter |
| 105 | + { |
| 106 | + /// <summary> |
| 107 | + /// Slot abbreviation for ths parameter set. |
| 108 | + /// </summary> |
| 109 | + public readonly string Slot; |
| 110 | + |
| 111 | + |
| 112 | + /// <summary> |
| 113 | + /// The binary flag data for this equipment parameter. |
| 114 | + /// Only the subset of values for this slot will be available. |
| 115 | + /// </summary> |
| 116 | + public Dictionary<EquipmentParameterFlag, bool?> Flags; |
| 117 | + |
| 118 | + /// <summary> |
| 119 | + /// Constructor. Slot is required. |
| 120 | + /// </summary> |
| 121 | + /// <param name="slot"></param> |
| 122 | + public EquipmentParameter(string slot) |
| 123 | + { |
| 124 | + Slot = slot; |
| 125 | + var keys = GetFlagList(slot); |
| 126 | + foreach(var key in keys) |
| 127 | + { |
| 128 | + Flags.Add(key, null); |
| 129 | + } |
| 130 | + } |
| 131 | + |
| 132 | + /// <summary> |
| 133 | + /// Get the list of dictionary keys available for this parameter slot. |
| 134 | + /// </summary> |
| 135 | + /// <returns></returns> |
| 136 | + public List<EquipmentParameterFlag> GetFlagList() |
| 137 | + { |
| 138 | + var ret = new List<EquipmentParameterFlag>(); ; |
| 139 | + foreach (var kv in Flags) |
| 140 | + { |
| 141 | + ret.Add(kv.Key); |
| 142 | + } |
| 143 | + return ret; |
| 144 | + |
| 145 | + } |
| 146 | + |
| 147 | + /// <summary> |
| 148 | + /// Gets the list of dictionary keys available for this slot type. |
| 149 | + /// </summary> |
| 150 | + /// <returns></returns> |
| 151 | + public static List<EquipmentParameterFlag> GetFlagList(string slot) |
| 152 | + { |
| 153 | + var ret = new List<EquipmentParameterFlag>(); |
| 154 | + if (slot == "met") |
| 155 | + { |
| 156 | + // Head flags setup. |
| 157 | + |
| 158 | + } |
| 159 | + else if (slot == "top") |
| 160 | + { |
| 161 | + // Body flags setup. |
| 162 | + |
| 163 | + } |
| 164 | + else if (slot == "glv") |
| 165 | + { |
| 166 | + // Glove flags setup. |
| 167 | + |
| 168 | + } |
| 169 | + else if (slot == "dwn") |
| 170 | + { |
| 171 | + // Leg flags setup. |
| 172 | + |
| 173 | + } |
| 174 | + else if (slot == "sho") |
| 175 | + { |
| 176 | + // Foot flags setup. |
| 177 | + |
| 178 | + } |
| 179 | + return ret; |
| 180 | + } |
| 181 | + } |
| 182 | + |
| 183 | + |
| 184 | + /// <summary> |
| 185 | + /// Class representing an Equipment Deformation parameter for a given race/slot. |
| 186 | + /// </summary> |
| 187 | + public class EquipmentDeformationParameter |
| 188 | + { |
| 189 | + public bool bit0; |
| 190 | + public bool bit1; |
| 191 | + } |
| 192 | + |
| 193 | + /// <summary> |
| 194 | + /// Class representing the set of equipment deformation parameters for a given race. |
| 195 | + /// </summary> |
| 196 | + public class EquipmentDeformationParameterSet |
| 197 | + { |
| 198 | + |
| 199 | + public bool IsAccessorySet = false; |
| 200 | + |
| 201 | + /// <summary> |
| 202 | + /// The actual parameters contained in this set, by Slot Abbreviation. |
| 203 | + /// Strings should match up to Mdl.SlotAbbreviationDictionary Keys |
| 204 | + /// This element should always contain 5 entries: [met, top, glv, dwn, sho] |
| 205 | + /// </summary> |
| 206 | + public Dictionary<string, EquipmentDeformationParameter> Parameters; |
| 207 | + public EquipmentDeformationParameterSet(bool accessory = false) |
| 208 | + { |
| 209 | + IsAccessorySet = accessory; |
| 210 | + |
| 211 | + if (accessory) |
| 212 | + { |
| 213 | + Parameters = new Dictionary<string, EquipmentDeformationParameter>() { |
| 214 | + { "ear", new EquipmentDeformationParameter() }, |
| 215 | + { "nek", new EquipmentDeformationParameter() }, |
| 216 | + { "wrs", new EquipmentDeformationParameter() }, |
| 217 | + { "rir", new EquipmentDeformationParameter() }, |
| 218 | + { "ril", new EquipmentDeformationParameter() } |
| 219 | + }; |
| 220 | + } |
| 221 | + else |
| 222 | + { |
| 223 | + Parameters = new Dictionary<string, EquipmentDeformationParameter>() { |
| 224 | + { "met", new EquipmentDeformationParameter() }, |
| 225 | + { "top", new EquipmentDeformationParameter() }, |
| 226 | + { "glv", new EquipmentDeformationParameter() }, |
| 227 | + { "dwn", new EquipmentDeformationParameter() }, |
| 228 | + { "sho", new EquipmentDeformationParameter() } |
| 229 | + }; |
| 230 | + } |
| 231 | + } |
| 232 | + |
| 233 | + public static List<string> SlotsAsList(bool accessory) |
| 234 | + { |
| 235 | + if(accessory) |
| 236 | + { |
| 237 | + return new List<string>() { "ear", "nek", "wrs", "rir", "ril" }; |
| 238 | + } else |
| 239 | + { |
| 240 | + return new List<string>() { "met", "top", "glv", "dwn", "sho" }; |
| 241 | + } |
| 242 | + } |
| 243 | + } |
| 244 | +} |
0 commit comments