39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using ET;
|
|
|
|
namespace Cal.DataTable
|
|
{
|
|
public partial class ServerItemLimitCategory
|
|
{
|
|
public void FillDic(Dictionary<int, int> _dic)
|
|
{
|
|
_dic.Clear();
|
|
foreach (var kv in this.dict)
|
|
{
|
|
int a = kv.Value.MinCount;
|
|
int b = kv.Value.MaxCount;
|
|
_dic.Add((int) kv.Key, RandomHelper.RandomNumber(a, b));
|
|
}
|
|
}
|
|
|
|
public void ReFillDic(Dictionary<int, int> _dic)
|
|
{
|
|
foreach (var kv in this.dict)
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |