Skip to content

Commit c77ffc6

Browse files
committed
Changed chance to decimal
1 parent 9038470 commit c77ffc6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/ExileLootDrop/CfgGroupItem.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public class CfgGroupItem
55
/// <summary>
66
/// Item chance
77
/// </summary>
8-
public int Chance { get; }
8+
public decimal Chance { get; }
99

1010
/// <summary>
1111
/// Item/group name
@@ -21,8 +21,8 @@ public CfgGroupItem(string line)
2121
var parts = line.Split(',');
2222
if (parts.Length != 2)
2323
throw new CfgGroupItemException($"Item line is invalid: {line}");
24-
int chance;
25-
if (!int.TryParse(parts[0], out chance))
24+
decimal chance;
25+
if (!decimal.TryParse(parts[0], out chance))
2626
throw new CfgGroupItemException($"Could not parse chance: {line}");
2727
Chance = chance;
2828
Item = parts[1].Trim();

src/ExileLootDrop/Loot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private List<LootItem> FlattenGroups(CfgGroup group, int depth = 0)
122122
var total = group.Items.Select(i => i.Chance).Sum();
123123
foreach (var item in group.Items.OrderByDescending(a => a.Chance))
124124
{
125-
var chance = (decimal)item.Chance / total;
125+
var chance = item.Chance / total;
126126
var child = _cfgGroups.Find(g => g.Name == item.Item);
127127
if (child != null)
128128
{

0 commit comments

Comments
 (0)