Changed chance to decimal

This commit is contained in:
Matthew McConnell
2016-09-28 16:48:55 +01:00
parent 90384706e3
commit c77ffc6ae6
2 changed files with 4 additions and 4 deletions

View File

@ -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();

View File

@ -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)
{