12121
This commit is contained in:
@@ -57,4 +57,9 @@ public static class GameEnum
|
||||
RetVigour,
|
||||
MapTo,
|
||||
}
|
||||
|
||||
public enum DicCode
|
||||
{
|
||||
Awaken,//觉醒配置
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,12 @@ public static class MessageEnum
|
||||
Marry,//婚姻消息
|
||||
Trade,//交易通知
|
||||
}
|
||||
public enum BroadcastCode
|
||||
{
|
||||
Gift,
|
||||
System,
|
||||
Award,
|
||||
Remind,
|
||||
Promote
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,9 @@ public interface IGameEquService
|
||||
|
||||
Task<game_equ> GetEquInfo(int equId);
|
||||
Task<game_equ_suit> GetEuqSuitInfo(string suitCode);
|
||||
|
||||
#endregion
|
||||
|
||||
#region 用户装备
|
||||
|
||||
Task<List<unit_user_equ>> GetUserEquData(string userId, int type, string equName, int PageIndex, int PageSize,
|
||||
@@ -21,6 +23,7 @@ public interface IGameEquService
|
||||
|
||||
Task<bool> UpdateUserEquInfo(unit_user_equ equData, bool isAddLog = false, string code = "",
|
||||
string remark = "");
|
||||
|
||||
Task<bool> DeductUserEqu(string userId, List<unit_user_equ> equData, string remark);
|
||||
Task<bool> DeductUserEqu(string userId, int equId, int count, string remark);
|
||||
|
||||
@@ -30,12 +33,25 @@ public interface IGameEquService
|
||||
Task<List<unit_user_equ>> GetUserOnEqu(string userId);
|
||||
Task<bool> EquOnOrDown(unit_user_equ data, int state);
|
||||
Task<List<UserEquSuit>> GetUserEquSuit(string userId);
|
||||
|
||||
#endregion
|
||||
|
||||
#region 辅助
|
||||
#region 觉醒相关
|
||||
|
||||
Task<game_equ_awaken> GetEquAwakenInfo(string atId);
|
||||
Task<game_equ_awaken> GetRandomOneAwakenByCode(string code);
|
||||
Task<EquAwakenData> GetEquAwakenInfoByLev(string atId, int lev);
|
||||
|
||||
#endregion
|
||||
|
||||
#region 强化相关
|
||||
|
||||
Task<game_equ_up> GetUserEquUpData(int lev);
|
||||
#endregion
|
||||
|
||||
#region 辅助
|
||||
|
||||
Task<int> GetUserEquWeightSum(string userId);
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public interface IGameDicService
|
||||
{
|
||||
Task<game_dic> GetDicInfo(string code);
|
||||
}
|
||||
@@ -43,4 +43,11 @@ public interface IMessageService
|
||||
List<MsgEventBtn> btns = null, int days = 10);
|
||||
|
||||
#endregion
|
||||
|
||||
#region 广播消息
|
||||
|
||||
Task<List<game_broadcast>> GetBroadcastData(int area);
|
||||
Task<bool> SendBroadcast(string userId, string code, string msg);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -191,6 +191,11 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
{
|
||||
await AddEquLog(equData, code, remark);
|
||||
}
|
||||
|
||||
if (equData.isOn == 1)
|
||||
{
|
||||
await ClearUserOnEqu(equData.userId);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -429,6 +434,98 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 觉醒
|
||||
|
||||
public async Task<game_equ_awaken> GetEquAwakenInfo(string atId)
|
||||
{
|
||||
string key = string.Format(BaseCache.BaseCacheKeys, "EquData", "AwakenData");
|
||||
var data = await redis.GetHashAsync<game_equ_awaken>(key, atId);
|
||||
if (data == null)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<game_equ_awaken>();
|
||||
data = await db.Queryable<game_equ_awaken>().Where(i => i.atId == atId).SingleAsync();
|
||||
if (data != null)
|
||||
{
|
||||
await redis.AddHashAsync(key, atId, data);
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<game_equ_awaken> GetRandomOneAwakenByCode(string code)
|
||||
{
|
||||
game_equ_awaken attr = new game_equ_awaken();
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<game_equ_awaken>();
|
||||
var list = await db.Queryable<game_equ_awaken>().Where(i => i.position.Contains(code)).ToListAsync();
|
||||
if (list.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<object> data = new List<object>();
|
||||
List<ushort> weights = new List<ushort>();
|
||||
List<object> result = new List<object>();
|
||||
Random rand = new Random();
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
data.Add(item);
|
||||
weights.Add(ushort.Parse(item.random.ToString()));
|
||||
}
|
||||
|
||||
RandomAssist random = new RandomAssist(1);
|
||||
|
||||
result = random.ControllerRandomExtract(rand, data, weights);
|
||||
if (result.Count > 0)
|
||||
{
|
||||
attr = result[0] as game_equ_awaken;
|
||||
return attr;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<EquAwakenData> GetEquAwakenInfoByLev(string atId, int lev)
|
||||
{
|
||||
var awakenInfo = await GetEquAwakenInfo(atId);
|
||||
EquAwakenData awaken = new EquAwakenData();
|
||||
foreach (var item in awakenInfo.levAttr)
|
||||
{
|
||||
if (item.lev == lev)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 强化相关
|
||||
|
||||
public async Task<game_equ_up> GetUserEquUpData(int lev)
|
||||
{
|
||||
string key = string.Format(BaseCache.BaseCacheKeys, "EquData", "EquUpData");
|
||||
var data = await redis.GetHashAsync<game_equ_up>(key, lev.ToString());
|
||||
if (data == null)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<game_equ_up>();
|
||||
data = await db.Queryable<game_equ_up>().Where(i => i.onLev <= lev && i.maxLev >= lev).FirstAsync();
|
||||
if (data != null)
|
||||
{
|
||||
await redis.AddHashAsync(key, lev.ToString(), data);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 辅助方法
|
||||
|
||||
@@ -832,7 +832,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
if (!string.IsNullOrEmpty(offSet))
|
||||
{
|
||||
var offsetData = JsonConvert.DeserializeObject<TowerNeed>(offSet);
|
||||
var chekResult = await GameBus.CheakNeed(userId, offsetData, "");
|
||||
var chekResult = await GameBus.CheckNeed(userId, offsetData);
|
||||
if (chekResult.result)
|
||||
{
|
||||
if (offsetData.isOp == 0)
|
||||
@@ -858,7 +858,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
|
||||
public async Task<List<game_city_map_bus>> GetMapBus(string BusCode, int v, int l)
|
||||
{
|
||||
string key = string.Format(BaseCache.BaseCacheKeys, "CITY_MAP_BUS", BusCode);
|
||||
string key = string.Format(BaseCache.BaseCacheKeys, "CityMapBus", BusCode);
|
||||
var data = await redis.GetAsync<List<game_city_map_bus>>(key);
|
||||
if (data == null)
|
||||
{
|
||||
@@ -877,7 +877,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
|
||||
public async Task<game_city_map_bus> GetMapBusInfo(int busId)
|
||||
{
|
||||
string key = string.Format(BaseCache.BaseCacheKeys, "CITY_MAP_BUS", "BUS_INFO");
|
||||
string key = string.Format(BaseCache.BaseCacheKeys, "CityMapBus", "BUS_INFO");
|
||||
if (await redis.HExistsHashAsync(key, busId.ToString()))
|
||||
{
|
||||
return await redis.GetHashAsync<game_city_map_bus>(key, busId.ToString());
|
||||
@@ -925,6 +925,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
#endregion
|
||||
|
||||
#region 地图资源
|
||||
|
||||
public async Task<game_city_map_res> GetMapResInfo(string resId)
|
||||
{
|
||||
string key = string.Format(BaseCache.BaseCacheKeys, "CityData", "MapResInfo");
|
||||
@@ -938,6 +939,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<List<game_city_map_res>> GetMapRes(string mapId)
|
||||
{
|
||||
string key = string.Format(BaseCache.BaseCacheKeys, "CityData", "MapRes");
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public class GameDicService(ISqlSugarClient DbClient, IRedisCache redis) : IGameDicService, ITransient
|
||||
{
|
||||
public async Task<game_dic> GetDicInfo(string code)
|
||||
{
|
||||
string key = string.Format(BaseCache.BaseCacheKey, "DicData");
|
||||
if (await redis.HExistsHashAsync(key, code))
|
||||
{
|
||||
return await redis.GetHashAsync<game_dic>(key, code);
|
||||
}
|
||||
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<game_dic>();
|
||||
var data = await db.Queryable<game_dic>().Where(it => it.code == code).SingleAsync();
|
||||
await redis.AddHashAsync(key, code, data);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -311,8 +311,9 @@ public class MessageService(ISqlSugarClient DbClient, IRedisCache redis) : IMess
|
||||
return await db.Queryable<unit_user_message_event>().Where(it => it.state == 0 && it.token == token).AnyAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> SendEventMsg(string userId, string code, string name, string sign, string pars,string token,
|
||||
List<MsgEventBtn> btns=null, int days = 10)
|
||||
public async Task<bool> SendEventMsg(string userId, string code, string name, string sign, string pars,
|
||||
string token,
|
||||
List<MsgEventBtn> btns = null, int days = 10)
|
||||
{
|
||||
unit_user_message_event data = new unit_user_message_event();
|
||||
data.eventId = StringAssist.NewGuid;
|
||||
@@ -331,8 +332,9 @@ public class MessageService(ISqlSugarClient DbClient, IRedisCache redis) : IMess
|
||||
}
|
||||
else
|
||||
{
|
||||
data.btns = btns;
|
||||
data.btns = btns;
|
||||
}
|
||||
|
||||
data.addTime = DateTime.Now;
|
||||
data.endTime = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddDays(days));
|
||||
data.token = token;
|
||||
@@ -347,4 +349,54 @@ public class MessageService(ISqlSugarClient DbClient, IRedisCache redis) : IMess
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 广播消息
|
||||
|
||||
public async Task<List<game_broadcast>> GetBroadcastData(int area)
|
||||
{
|
||||
List<game_broadcast> data = new List<game_broadcast>();
|
||||
string key = string.Format(BaseCache.BaseCacheKey, "GameBroadcast");
|
||||
var result = await redis.GetHashAllAsync<game_broadcast>(key);
|
||||
if (result.Count > 0)
|
||||
{
|
||||
data = result.Values.ToList();
|
||||
}
|
||||
|
||||
long time = TimeExtend.GetTimeStampSeconds;
|
||||
data = data.FindAll(it => (it.area == area || it.area == 0) && it.endTime > time);
|
||||
data = data.OrderByDescending(it => it.endTime).Take(2).ToList();
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<bool> SendBroadcast(string userId, string code, string msg)
|
||||
{
|
||||
game_broadcast add = new game_broadcast();
|
||||
add.Id = StringAssist.NewGuid;
|
||||
add.userId = userId;
|
||||
add.code = code;
|
||||
add.msg = msg;
|
||||
int area = 0;
|
||||
if (add.userId == "0")
|
||||
{
|
||||
add.area = 0;
|
||||
add.userNo = "0";
|
||||
add.nick = "海精灵";
|
||||
}
|
||||
else
|
||||
{
|
||||
var userService = App.GetService<IUnitUserService>();
|
||||
var userInfo = await userService.GetUserInfoByUserId(userId);
|
||||
add.area = (int)userInfo.areaId;
|
||||
add.userNo = userInfo.userNo;
|
||||
add.nick = userInfo.nick;
|
||||
area = add.area;
|
||||
}
|
||||
|
||||
add.endTime = TimeExtend.GetTimeStampSeconds + 300;
|
||||
string key = string.Format(BaseCache.BaseCacheKey, "GameBroadcast");
|
||||
bool result = await redis.AddHashAsync(key, add.Id, add);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public class GameBus
|
||||
public static class GameBus
|
||||
{
|
||||
#region 物品资源操作
|
||||
|
||||
@@ -96,20 +96,24 @@ public class GameBus
|
||||
|
||||
#region 验证
|
||||
|
||||
public static async Task<CheckTowerNeed> CheakNeed(string userId, TowerNeed item, string sid, int count = 1)
|
||||
public static async Task<CheckTowerNeed> CheckNeed(string userId, TowerNeed item, int count = 1)
|
||||
{
|
||||
CheckTowerNeed result = new CheckTowerNeed();
|
||||
result.Needs = new List<TowerNeed>();
|
||||
bool isok = true;
|
||||
int isDeal = 1;
|
||||
int isGive = 1;
|
||||
|
||||
item.isAsk = 1;
|
||||
if (item.code == nameof(GameEnum.PropCode.Equ))
|
||||
{
|
||||
var equService = App.GetService<IGameEquService>();
|
||||
int MyCount = await equService.GetUserEquByEquIdCount(userId, Convert.ToInt32(item.parameter));
|
||||
int neecCount = item.count * count;
|
||||
if (MyCount < neecCount)
|
||||
long needCount = item.count * count;
|
||||
item.count = needCount;
|
||||
item.onCount = MyCount;
|
||||
if (MyCount < needCount)
|
||||
{
|
||||
item.isAsk = 0;
|
||||
isok = false;
|
||||
}
|
||||
}
|
||||
@@ -132,29 +136,38 @@ public class GameBus
|
||||
}
|
||||
}
|
||||
|
||||
int needCount = item.count * count;
|
||||
long needCount = item.count * count;
|
||||
item.count = needCount;
|
||||
item.onCount = MyCount;
|
||||
if (MyCount < needCount)
|
||||
{
|
||||
isok = false;
|
||||
item.isAsk = 0;
|
||||
}
|
||||
}
|
||||
else if (item.code == nameof(GameEnum.PropCode.copper))
|
||||
{
|
||||
var accService = App.GetService<IUnitUserAccService>();
|
||||
var MyAcc = await accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
|
||||
decimal needAcc = item.count * count;
|
||||
long needAcc = item.count * count;
|
||||
item.count = needAcc;
|
||||
item.onCount = MyAcc;
|
||||
if (MyAcc < needAcc)
|
||||
{
|
||||
isok = false;
|
||||
item.isAsk = 0;
|
||||
}
|
||||
}
|
||||
else if (item.code == nameof(GameEnum.PropCode.gold))
|
||||
{
|
||||
var accService = App.GetService<IUnitUserAccService>();
|
||||
var MyAcc = await accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.gold));
|
||||
decimal needAcc = item.count * count;
|
||||
long needAcc = item.count * count;
|
||||
item.count = needAcc;
|
||||
item.onCount = MyAcc;
|
||||
if (MyAcc < needAcc)
|
||||
{
|
||||
item.isAsk = 0;
|
||||
isok = false;
|
||||
}
|
||||
}
|
||||
@@ -162,9 +175,12 @@ public class GameBus
|
||||
{
|
||||
var attrService = App.GetService<IUnitUserAttrService>();
|
||||
var MyAcc = await attrService.GetUserVigourInfo(userId);
|
||||
decimal neecAcc = item.count * count;
|
||||
if (MyAcc.vitality < neecAcc)
|
||||
long needAcc = item.count * count;
|
||||
item.count = needAcc;
|
||||
item.onCount = (long)MyAcc.vitality;
|
||||
if (MyAcc.vitality < needAcc)
|
||||
{
|
||||
item.isAsk = 0;
|
||||
isok = false;
|
||||
}
|
||||
}
|
||||
@@ -172,6 +188,8 @@ public class GameBus
|
||||
{
|
||||
var attrService = App.GetService<IUnitUserAttrService>();
|
||||
var MyLev = await attrService.GetUserLev(userId);
|
||||
item.count = item.count;
|
||||
item.onCount = MyLev;
|
||||
if (MyLev < item.count)
|
||||
{
|
||||
isok = false;
|
||||
@@ -181,18 +199,20 @@ public class GameBus
|
||||
result.result = isok;
|
||||
result.isDeal = isDeal;
|
||||
result.isGive = isGive;
|
||||
result.Needs.Add(item);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async Task<CheckTowerNeed> CheakNeed(string userId, List<TowerNeed> needs, string sid, int count = 1)
|
||||
public static async Task<CheckTowerNeed> CheckNeed(string userId, List<TowerNeed> needs, int count = 1)
|
||||
{
|
||||
CheckTowerNeed result = new CheckTowerNeed();
|
||||
result.Needs = new List<TowerNeed>();
|
||||
bool isok = true;
|
||||
int isDeal = 1;
|
||||
int isGive = 1;
|
||||
foreach (var item in needs)
|
||||
{
|
||||
var cheakResult = await CheakNeed(userId, item, sid, count);
|
||||
var cheakResult = await CheckNeed(userId, item, count);
|
||||
if (isok)
|
||||
{
|
||||
isok = cheakResult.result;
|
||||
@@ -208,7 +228,116 @@ public class GameBus
|
||||
isGive = 0;
|
||||
}
|
||||
|
||||
item.isAsk = cheakResult.result ? 1 : 0;
|
||||
result.Needs.AddRange(cheakResult.Needs);
|
||||
}
|
||||
|
||||
result.result = isok;
|
||||
result.isDeal = isDeal;
|
||||
result.isGive = isGive;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async Task<CheckTowerNeeds> CheckNeeds(string userId, List<TowerNeeds> needs, int count = 1)
|
||||
{
|
||||
CheckTowerNeeds result = new CheckTowerNeeds();
|
||||
bool isok = true;
|
||||
int isDeal = 1;
|
||||
int isGive = 1;
|
||||
result.Needs = new List<TowerNeeds>();
|
||||
foreach (var item in needs)
|
||||
{
|
||||
item.isAsk = 1;
|
||||
if (item.code == nameof(GameEnum.PropCode.Equ))
|
||||
{
|
||||
var equService = App.GetService<IGameEquService>();
|
||||
int MyCount = await equService.GetUserEquByEquIdCount(userId, Convert.ToInt32(item.parameter));
|
||||
long needCount = item.count * count;
|
||||
item.count = needCount;
|
||||
item.onCount = MyCount;
|
||||
if (MyCount < needCount)
|
||||
{
|
||||
item.isAsk = 0;
|
||||
isok = false;
|
||||
}
|
||||
}
|
||||
else if (item.code == nameof(GameEnum.PropCode.Goods))
|
||||
{
|
||||
int MyCount = 0;
|
||||
var goodsService = App.GetService<IGameGoodsService>();
|
||||
var goodsInfo = await goodsService.GetUserGoodsInfo(userId, Convert.ToInt32(item.parameter));
|
||||
if (goodsInfo != null)
|
||||
{
|
||||
MyCount = (int)goodsInfo.count;
|
||||
if (goodsInfo.isDeal == 0)
|
||||
{
|
||||
isDeal = 0;
|
||||
}
|
||||
|
||||
if (goodsInfo.isGive == 0)
|
||||
{
|
||||
isGive = 0;
|
||||
}
|
||||
}
|
||||
|
||||
long needCount = item.count * count;
|
||||
item.count = needCount;
|
||||
item.onCount = MyCount;
|
||||
if (MyCount < needCount)
|
||||
{
|
||||
isok = false;
|
||||
item.isAsk = 0;
|
||||
}
|
||||
}
|
||||
else if (item.code == nameof(GameEnum.PropCode.copper))
|
||||
{
|
||||
var accService = App.GetService<IUnitUserAccService>();
|
||||
var MyAcc = await accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
|
||||
long needAcc = item.count * count;
|
||||
item.count = needAcc;
|
||||
item.onCount = MyAcc;
|
||||
if (MyAcc < needAcc)
|
||||
{
|
||||
isok = false;
|
||||
item.isAsk = 0;
|
||||
}
|
||||
}
|
||||
else if (item.code == nameof(GameEnum.PropCode.gold))
|
||||
{
|
||||
var accService = App.GetService<IUnitUserAccService>();
|
||||
var MyAcc = await accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.gold));
|
||||
long needAcc = item.count * count;
|
||||
item.count = needAcc;
|
||||
item.onCount = MyAcc;
|
||||
if (MyAcc < needAcc)
|
||||
{
|
||||
item.isAsk = 0;
|
||||
isok = false;
|
||||
}
|
||||
}
|
||||
else if (item.code == nameof(GameEnum.PropCode.vigour)) //活力
|
||||
{
|
||||
var attrService = App.GetService<IUnitUserAttrService>();
|
||||
var MyAcc = await attrService.GetUserVigourInfo(userId);
|
||||
long needAcc = item.count * count;
|
||||
item.count = needAcc;
|
||||
item.onCount = (long)MyAcc.vitality;
|
||||
if (MyAcc.vitality < needAcc)
|
||||
{
|
||||
item.isAsk = 0;
|
||||
isok = false;
|
||||
}
|
||||
}
|
||||
else if (item.code == nameof(GameEnum.PropCode.lev))
|
||||
{
|
||||
var attrService = App.GetService<IUnitUserAttrService>();
|
||||
var MyLev = await attrService.GetUserLev(userId);
|
||||
item.count = item.count;
|
||||
item.onCount = MyLev;
|
||||
if (MyLev < item.count)
|
||||
{
|
||||
isok = false;
|
||||
}
|
||||
}
|
||||
result.Needs.Add(item);
|
||||
}
|
||||
|
||||
@@ -240,7 +369,7 @@ public class GameBus
|
||||
foreach (var item in timeAward)
|
||||
{
|
||||
var onAward = result.FindIndex(it => it.code == item.code && it.parameter == item.par);
|
||||
if(onAward>-1)
|
||||
if (onAward > -1)
|
||||
{
|
||||
result[onAward].count += item.count;
|
||||
}
|
||||
@@ -256,7 +385,6 @@ public class GameBus
|
||||
result.Add(add);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -271,10 +399,12 @@ public class GameBus
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
if (random.data.Count == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
double totalWeight = random.data.Sum(it => it.chance);
|
||||
int rnd = _randomInstance.Next(Convert.ToInt32(totalWeight) + 1);
|
||||
double current = 0;
|
||||
@@ -290,6 +420,7 @@ public class GameBus
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static List<RandomData> RandomHandleByChance(RandomModel random, int luck = 0)
|
||||
{
|
||||
var _randomInstance = new Random();
|
||||
@@ -299,11 +430,12 @@ public class GameBus
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
if (random.data.Count == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
foreach (var item in random.data)
|
||||
{
|
||||
double rnd = _randomInstance.NextDouble();
|
||||
@@ -313,6 +445,7 @@ public class GameBus
|
||||
result.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user