zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Server/Model/Generate/Data/Partial/ServerItemLimitCategory.Cus...

39 lines
1.0 KiB
C#
Raw Normal View History

2021-09-07 16:19:55 +08:00
using System;
using System.Collections.Generic;
2021-09-07 16:20:46 +08:00
using ET;
2021-09-07 16:19:55 +08:00
namespace Cal.DataTable
{
2021-09-07 16:20:46 +08:00
public partial class ServerItemLimitCategory
2021-09-07 16:19:55 +08:00
{
2021-09-07 16:20:46 +08:00
public void FillDic(Dictionary<int, int> _dic)
2021-09-07 16:19:55 +08:00
{
2021-09-07 16:20:46 +08:00
_dic.Clear();
foreach (var kv in this.dict)
2021-09-07 16:19:55 +08:00
{
2021-09-07 16:20:46 +08:00
int a = kv.Value.MinCount;
int b = kv.Value.MaxCount;
_dic.Add((int) kv.Key, RandomHelper.RandomNumber(a, b));
}
2021-09-07 16:19:55 +08:00
}
2021-09-07 16:20:46 +08:00
public void ReFillDic(Dictionary<int, int> _dic)
2021-09-07 16:19:55 +08:00
{
2021-09-07 16:20:46 +08:00
foreach (var kv in this.dict)
2021-09-07 16:19:55 +08:00
{
2021-09-07 16:20:46 +08:00
int a = kv.Value.MinCount;
int b = kv.Value.MaxCount;
int value = RandomHelper.RandomNumber(a, b);
if (_dic.TryGetValue((int) kv.Key, out int count))
{
if (count > value)
_dic[(int) kv.Key] = value;
}
else
{
_dic[(int) kv.Key] = value;
}
}
2021-09-07 16:19:55 +08:00
}
}
2021-09-07 16:20:46 +08:00
}