This commit is contained in:
Putoo
2026-06-26 18:32:15 +08:00
parent c374f27d16
commit aefd94ccd6
5 changed files with 21 additions and 6 deletions

View File

@@ -22,6 +22,7 @@ public class RandomData
public string code { get; set; }
public string name { get; set; }
public string par { get; set; }
public long count { get; set; }
public int minCount { get; set; }
public int maxCount { get; set; }
public double chance { get; set; }
}

View File

@@ -364,6 +364,7 @@ public static class GameBus
{
return null;
}
double totalWeight = data.Sum(it => it.random);
int rnd = _randomInstance.Next(Convert.ToInt32(totalWeight) + 1);
double current = 0;
@@ -399,7 +400,7 @@ public static class GameBus
var onAward = result.FindIndex(it => it.code == item.code && it.parameter == item.par);
if (onAward > -1)
{
result[onAward].count += item.count;
result[onAward].count += RandomAssist.GetFormatedNumeric(item.minCount, item.maxCount);
}
else
{
@@ -408,7 +409,7 @@ public static class GameBus
code = item.code,
name = item.name,
parameter = item.par,
count = item.count
count = RandomAssist.GetFormatedNumeric(item.minCount, item.maxCount)
};
result.Add(add);
}

View File

@@ -33,7 +33,15 @@ public class GoodsController : ControllerBase
string userId = StateHelper.userId;
int count = await _goodsService.GetUserGoodsCount(userId, goodsId);
int UseState = 0;
switch (goodsInfo.code)
{
case "Pack":
UseState = 1;
break;
}
return PoAction.Ok(new { goods = goodsInfo, count });
return PoAction.Ok(new { goods = goodsInfo, count, use = UseState });
}
}