2024-05-22 17:31:19 +02:00
|
|
|
|
// ReSharper disable CheckNamespace
|
|
|
|
|
// ReSharper disable InconsistentNaming
|
|
|
|
|
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using MonoMod;
|
|
|
|
|
|
|
|
|
|
namespace Manager;
|
|
|
|
|
|
2024-08-08 08:32:25 +02:00
|
|
|
|
public class patch_MA2Record : MA2Record
|
2024-05-22 17:31:19 +02:00
|
|
|
|
{
|
|
|
|
|
[MonoModIgnore]
|
|
|
|
|
private static extern Ma2fileParamID.Def getParamIDFromRec(Ma2fileRecordID.Def rec, int index);
|
|
|
|
|
|
|
|
|
|
[MonoModReplace]
|
|
|
|
|
public new float getF32(uint index)
|
|
|
|
|
{
|
|
|
|
|
if (index >= _str.Count)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var paramIDFromRec = getParamIDFromRec(_recID, (int)index);
|
|
|
|
|
|
|
|
|
|
if (!paramIDFromRec.isValid() || !paramIDFromRec.isAvailableFloat() || _str[(int)index].Length == 0)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!float.TryParse(_str[(int)index], NumberStyles.Float, CultureInfo.InvariantCulture, out var num))
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return num;
|
|
|
|
|
}
|
|
|
|
|
}
|