public static int GetArmorPieceColor(string partName, int colorNumber, ACR_Items.ColorType color) { try { GFFStruct colorStruct = ALFA.Shared.Modules.InfoStore.ModifiedGff[ACR_Items.ModelChangeVarName].TopLevelStruct[partName].ValueStruct["ArmorTint"].ValueStruct; return GetColorFromTintStruct(colorStruct, colorNumber, color); } catch { } return -1; }
private static int GetColorFromTintStruct(GFFStruct colorStruct, int colorNumber, ACR_Items.ColorType color) { switch (color) { case ACR_Items.ColorType.All: int retVal = colorStruct[colorNumber.ToString()].ValueStruct["r"].ValueByte * 256 * 256; retVal += colorStruct[colorNumber.ToString()].ValueStruct["g"].ValueByte * 256; retVal += colorStruct[colorNumber.ToString()].ValueStruct["b"].ValueByte; return retVal; case ACR_Items.ColorType.Blue: return colorStruct[colorNumber.ToString()].ValueStruct["b"].ValueByte; case ACR_Items.ColorType.Green: return colorStruct[colorNumber.ToString()].ValueStruct["g"].ValueByte; case ACR_Items.ColorType.Red: return colorStruct[colorNumber.ToString()].ValueStruct["r"].ValueByte; } return -1; }