mirror of
https://github.com/sp-tarkov/assembly-tool.git
synced 2025-02-13 05:10:46 -05:00
Remove more not needed manual remaps, dynamically remap item templates (different from the item objects) and clean up
This commit is contained in:
parent
c26df580d2
commit
06602ce037
@ -1189,96 +1189,6 @@
|
|||||||
"ExcludeNestedTypes": []
|
"ExcludeNestedTypes": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"NewTypeName": "SecureContainerTemplateClass",
|
|
||||||
"OriginalTypeName": "GClass2827",
|
|
||||||
"UseForceRename": false,
|
|
||||||
"SearchParams": {
|
|
||||||
"IsPublic": true,
|
|
||||||
"IncludeMethods": [],
|
|
||||||
"ExcludeMethods": [],
|
|
||||||
"IncludeFields": [
|
|
||||||
"containType"
|
|
||||||
],
|
|
||||||
"ExcludeFields": [],
|
|
||||||
"IncludeProperties": [],
|
|
||||||
"ExcludeProperties": [],
|
|
||||||
"IncludeNestedTypes": [],
|
|
||||||
"ExcludeNestedTypes": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"NewTypeName": "Meds2Class",
|
|
||||||
"OriginalTypeName": "GClass2855",
|
|
||||||
"UseForceRename": false,
|
|
||||||
"SearchParams": {
|
|
||||||
"IsPublic": true,
|
|
||||||
"IncludeMethods": [],
|
|
||||||
"ExcludeMethods": [],
|
|
||||||
"IncludeFields": [
|
|
||||||
"BodyPartTimeMults"
|
|
||||||
],
|
|
||||||
"ExcludeFields": [],
|
|
||||||
"IncludeProperties": [],
|
|
||||||
"ExcludeProperties": [],
|
|
||||||
"IncludeNestedTypes": [],
|
|
||||||
"ExcludeNestedTypes": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"NewTypeName": "RepairKitClass",
|
|
||||||
"OriginalTypeName": "GClass2860",
|
|
||||||
"UseForceRename": false,
|
|
||||||
"SearchParams": {
|
|
||||||
"IsPublic": true,
|
|
||||||
"IncludeMethods": [],
|
|
||||||
"ExcludeMethods": [],
|
|
||||||
"IncludeFields": [
|
|
||||||
"TargetItemFilter"
|
|
||||||
],
|
|
||||||
"ExcludeFields": [],
|
|
||||||
"IncludeProperties": [],
|
|
||||||
"ExcludeProperties": [],
|
|
||||||
"IncludeNestedTypes": [],
|
|
||||||
"ExcludeNestedTypes": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"NewTypeName": "MoneyClass",
|
|
||||||
"OriginalTypeName": "GClass2870",
|
|
||||||
"UseForceRename": false,
|
|
||||||
"SearchParams": {
|
|
||||||
"IsPublic": true,
|
|
||||||
"IncludeMethods": [],
|
|
||||||
"ExcludeMethods": [],
|
|
||||||
"IncludeFields": [
|
|
||||||
"eqMax"
|
|
||||||
],
|
|
||||||
"ExcludeFields": [],
|
|
||||||
"IncludeProperties": [],
|
|
||||||
"ExcludeProperties": [],
|
|
||||||
"IncludeNestedTypes": [],
|
|
||||||
"ExcludeNestedTypes": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"NewTypeName": "ThrowableWeaponClass",
|
|
||||||
"OriginalTypeName": "GClass2872",
|
|
||||||
"UseForceRename": false,
|
|
||||||
"SearchParams": {
|
|
||||||
"IsPublic": true,
|
|
||||||
"IncludeMethods": [],
|
|
||||||
"ExcludeMethods": [],
|
|
||||||
"IncludeFields": [
|
|
||||||
"MinFragmentDamage"
|
|
||||||
],
|
|
||||||
"ExcludeFields": [],
|
|
||||||
"IncludeProperties": [],
|
|
||||||
"ExcludeProperties": [],
|
|
||||||
"IncludeNestedTypes": [],
|
|
||||||
"ExcludeNestedTypes": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"NewTypeName": "BossKnightBrainClass",
|
"NewTypeName": "BossKnightBrainClass",
|
||||||
"OriginalTypeName": "GClass292",
|
"OriginalTypeName": "GClass292",
|
||||||
|
@ -63,7 +63,7 @@ public class ReCodeItRemapper
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleTypeTableRemaps(assemblyPath, types);
|
GenerateDynamicRemaps(assemblyPath, types);
|
||||||
|
|
||||||
var tasks = new List<Task>(remapModels.Count);
|
var tasks = new List<Task>(remapModels.Count);
|
||||||
foreach (var remap in remapModels)
|
foreach (var remap in remapModels)
|
||||||
@ -430,12 +430,19 @@ public class ReCodeItRemapper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleTypeTableRemaps(string path, IEnumerable<TypeDef> types)
|
private void GenerateDynamicRemaps(string path, IEnumerable<TypeDef> types)
|
||||||
{
|
{
|
||||||
// HACK: Because this is written in net8 and the assembly is net472 we must resolve the type this way instead of
|
// HACK: Because this is written in net8 and the assembly is net472 we must resolve the type this way instead of
|
||||||
// filtering types directly using GetTypes() Otherwise, it causes serialization issues.
|
// filtering types directly using GetTypes() Otherwise, it causes serialization issues.
|
||||||
// This is also necessary because we can't access non-compile time constants with dnlib.
|
// This is also necessary because we can't access non-compile time constants with dnlib.
|
||||||
var templateMappingTypeDef = types.Single(t => t.FindField("TypeTable") != null);
|
var templateMappingTypeDef = types.SingleOrDefault(t => t.FindField("TypeTable") != null);
|
||||||
|
|
||||||
|
if (templateMappingTypeDef is null)
|
||||||
|
{
|
||||||
|
Logger.Log("Could not find type for field TypeTable", ConsoleColor.Red);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var assembly = Assembly.LoadFrom(path);
|
var assembly = Assembly.LoadFrom(path);
|
||||||
var templateMappingClass = assembly.Modules
|
var templateMappingClass = assembly.Modules
|
||||||
.First()
|
.First()
|
||||||
@ -443,7 +450,7 @@ public class ReCodeItRemapper
|
|||||||
|
|
||||||
if (templateMappingClass is null)
|
if (templateMappingClass is null)
|
||||||
{
|
{
|
||||||
Logger.Log($"Could not find {templateMappingTypeDef.Name} in the assembly.", ConsoleColor.Red);
|
Logger.Log($"Could not resolve type for {templateMappingTypeDef.Name}", ConsoleColor.Red);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +458,18 @@ public class ReCodeItRemapper
|
|||||||
.GetField("TypeTable")
|
.GetField("TypeTable")
|
||||||
.GetValue(templateMappingClass);
|
.GetValue(templateMappingClass);
|
||||||
|
|
||||||
foreach (var type in typeTable)
|
BuildAssociationFromTable(typeTable, "ItemClass");
|
||||||
|
|
||||||
|
var templateTypeTable = (Dictionary<string, Type>)templateMappingClass
|
||||||
|
.GetField("TemplateTypeTable")
|
||||||
|
.GetValue(templateMappingClass);
|
||||||
|
|
||||||
|
BuildAssociationFromTable(templateTypeTable, "TemplateClass");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BuildAssociationFromTable(Dictionary<string, Type> table, string extName)
|
||||||
|
{
|
||||||
|
foreach (var type in table)
|
||||||
{
|
{
|
||||||
if (DataProvider.ItemTemplates!.TryGetValue(type.Key, out var template))
|
if (DataProvider.ItemTemplates!.TryGetValue(type.Key, out var template))
|
||||||
{
|
{
|
||||||
@ -462,7 +480,7 @@ public class ReCodeItRemapper
|
|||||||
var remap = new RemapModel
|
var remap = new RemapModel
|
||||||
{
|
{
|
||||||
OriginalTypeName = type.Value.Name,
|
OriginalTypeName = type.Value.Name,
|
||||||
NewTypeName = $"{template._name}Class",
|
NewTypeName = $"{template._name}{extName}",
|
||||||
UseForceRename = true
|
UseForceRename = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user