mirror of
https://github.com/maca134/ExileLootDrop.git
synced 2024-08-30 17:22:13 +00:00
Changed chance to decimal
This commit is contained in:
@ -5,7 +5,7 @@ namespace ExileLootDrop
|
||||
/// <summary>
|
||||
/// Item chance
|
||||
/// </summary>
|
||||
public int Chance { get; }
|
||||
public decimal Chance { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Item/group name
|
||||
@ -21,8 +21,8 @@ namespace ExileLootDrop
|
||||
var parts = line.Split(',');
|
||||
if (parts.Length != 2)
|
||||
throw new CfgGroupItemException($"Item line is invalid: {line}");
|
||||
int chance;
|
||||
if (!int.TryParse(parts[0], out chance))
|
||||
decimal chance;
|
||||
if (!decimal.TryParse(parts[0], out chance))
|
||||
throw new CfgGroupItemException($"Could not parse chance: {line}");
|
||||
Chance = chance;
|
||||
Item = parts[1].Trim();
|
||||
|
@ -122,7 +122,7 @@ namespace ExileLootDrop
|
||||
var total = group.Items.Select(i => i.Chance).Sum();
|
||||
foreach (var item in group.Items.OrderByDescending(a => a.Chance))
|
||||
{
|
||||
var chance = (decimal)item.Chance / total;
|
||||
var chance = item.Chance / total;
|
||||
var child = _cfgGroups.Find(g => g.Name == item.Item);
|
||||
if (child != null)
|
||||
{
|
||||
|
Reference in New Issue
Block a user