Repeatable quest generation MongoID conversion (#439)
* Update repeatable quest generation for mongoid, add new server localizations, switch `Traders` to MongoId * Give error default value
This commit is contained in:
@@ -55,5 +55,29 @@
|
||||
{
|
||||
return values.Select(v => v * factor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper to determine if one double is approx equal to another double
|
||||
/// </summary>
|
||||
/// <param name="value">Value to check</param>
|
||||
/// <param name="target">Target value</param>
|
||||
/// <param name="error">Error value</param>
|
||||
/// <returns>True if value is approx target within the error range</returns>
|
||||
public static bool Approx(this double value, double target, double error = 0.001d)
|
||||
{
|
||||
return Math.Abs(value - target) <= error;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper to determine if one float is approx equal to another float
|
||||
/// </summary>
|
||||
/// <param name="value">Value to check</param>
|
||||
/// <param name="target">Target value</param>
|
||||
/// <param name="error">Error value</param>
|
||||
/// <returns>True if value is approx target within the error range</returns>
|
||||
public static bool Approx(this float value, float target, float error = 0.001f)
|
||||
{
|
||||
return Math.Abs(value - target) <= error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user