This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #305 from aspriddell/add-proportion-struct
create struct to handle modern stats ratio values
- Loading branch information
Showing
2 changed files
with
103 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Dragon6 API Copyright DragonFruit Network <inbox@dragonfruit.network> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
namespace DragonFruit.Six.Api.Modern.Containers | ||
{ | ||
public struct RatioBackedStat | ||
{ | ||
internal RatioBackedStat(uint total, float ratio) | ||
{ | ||
Ratio = ratio; | ||
Value = (int)(total * Ratio); | ||
} | ||
|
||
/// <summary> | ||
/// Converted value formed of the total applicable values multiplied by the <see cref="Ratio"/> | ||
/// </summary> | ||
public int Value { get; } | ||
|
||
/// <summary> | ||
/// The ratio of valid items relative to the total | ||
/// </summary> | ||
public float Ratio { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters