2
2
using System . Collections . Generic ;
3
3
using System . Dynamic ;
4
4
using System . IO ;
5
+ using System . Linq ;
5
6
using System . Text ;
6
7
using System . Text . RegularExpressions ;
7
8
using System . Threading . Tasks ;
@@ -44,6 +45,31 @@ internal static async Task ApplyRgspFile(string filePath, IndexFile index = null
44
45
await SetScalingParameter ( rgsp , index , modlist ) ;
45
46
}
46
47
48
+ /// <summary>
49
+ /// Disables the .rgsp file for this race, if it exists, and restores the .cmp file for the race back to default.
50
+ /// </summary>
51
+ /// <param name="race"></param>
52
+ /// <param name="gender"></param>
53
+ /// <returns></returns>
54
+ public static async Task DisableRgspMod ( XivSubRace race , XivGender gender )
55
+ {
56
+ var path = GetRgspPath ( race , gender ) ;
57
+ var _modding = new Modding ( XivCache . GameInfo . GameDirectory ) ;
58
+
59
+
60
+ var modlist = await _modding . GetModListAsync ( ) ;
61
+ var mod = modlist . Mods . FirstOrDefault ( x => x . fullPath == path ) ;
62
+ if ( mod != null && mod . enabled )
63
+ {
64
+ await _modding . ToggleModStatus ( path , false ) ;
65
+ } else
66
+ {
67
+ var def = await GetScalingParameter ( race , gender , true ) ;
68
+ await SetScalingParameter ( def ) ;
69
+ }
70
+
71
+ }
72
+
47
73
internal static async Task RestoreDefaultScaling ( string rgspPath , IndexFile index = null , ModList modlist = null )
48
74
{
49
75
var match = RgspPathExtractFormat . Match ( rgspPath ) ;
@@ -55,6 +81,14 @@ internal static async Task RestoreDefaultScaling(string rgspPath, IndexFile inde
55
81
await RestoreDefaultScaling ( race , gender , index , modlist ) ;
56
82
}
57
83
84
+ public static string GetRgspPath ( XivSubRace race , XivGender gender )
85
+ {
86
+ var subraceId = ( int ) race ;
87
+ var genderId = ( int ) gender ;
88
+ var rgspFilePath = String . Format ( RgspPathFormat , subraceId , genderId ) ;
89
+ return rgspFilePath ;
90
+ }
91
+
58
92
/// <summary>
59
93
/// Restores the default settings back into the CMP file.
60
94
/// Does NOT delete .rgsp entry.
@@ -78,11 +112,9 @@ internal static async Task RestoreDefaultScaling(XivSubRace race, XivGender gend
78
112
/// <returns></returns>
79
113
public static async Task SaveScalingParameter ( RacialGenderScalingParameter rgsp , string sourceApplication , IndexFile index = null , ModList modlist = null )
80
114
{
81
- var subraceId = ( int ) rgsp . Race ;
82
- var genderId = ( int ) rgsp . Gender ;
83
115
84
116
// Write the .rgsp file and let the DAT functions handle applying it.
85
- var rgspFilePath = String . Format ( RgspPathFormat , subraceId , genderId ) ;
117
+ var rgspFilePath = GetRgspPath ( rgsp . Race , rgsp . Gender ) ;
86
118
87
119
var bytes = rgsp . GetBytes ( ) ;
88
120
@@ -104,6 +136,13 @@ public static async Task<RacialGenderScalingParameter> GetScalingParameter(XivS
104
136
return cmp . GetScalingParameter ( race , gender ) ;
105
137
}
106
138
139
+ /// <summary>
140
+ /// Performs the base level alteration to the CMP file, without going through .rgsp files.
141
+ /// </summary>
142
+ /// <param name="data"></param>
143
+ /// <param name="index"></param>
144
+ /// <param name="modlist"></param>
145
+ /// <returns></returns>
107
146
private static async Task SetScalingParameter ( RacialGenderScalingParameter data , IndexFile index = null , ModList modlist = null )
108
147
{
109
148
var cmp = await GetCharaMakeParameterSet ( false , index , modlist ) ;
0 commit comments