12121
This commit is contained in:
@@ -4,18 +4,18 @@ public static class GameConfig
|
||||
{
|
||||
public const int GameMaxLev = 320;//最大等级
|
||||
public const int OnLineTime = 30;//在线延迟时间(分钟)
|
||||
public const int SendChatGoodsBase = 10014;//小海螺
|
||||
public const int SendChatGoodsBase = 10000;//小海螺
|
||||
public const int SendChatGoodsArea = 10001;//大海螺
|
||||
public const int SendChatGoodsService = 10002;//金海螺
|
||||
public const int UpLevAddWeight = 10;//升级增加负重
|
||||
public const int GameBaseVigour = 50;//初始活力
|
||||
public const int GameRelationEnemyNeedGold = 300;//添加仇人所需金元
|
||||
public const int GameUpdateNickNeedGoods = 10001;//更新昵称所需道具
|
||||
public const int GameUpdateSexNeedGoods = 10001;//更新性别所需道具
|
||||
public const int GameUpdateNickNeedGoods = 10018;//更新昵称所需道具
|
||||
public const int GameUpdateSexNeedGoods = 10065;//更新性别所需道具
|
||||
public const int GameUserFriendMaxCount = 50;//好友最大上限人数
|
||||
public const int GameAutoBagGoodsId = 10001;//百宝箱物品ID
|
||||
public const int GameAutoDrugGoodsId = 10001;//急救箱物品ID
|
||||
public const int GameAutoBagGoodsId = 10022;//百宝箱物品ID
|
||||
public const int GameAutoDrugGoodsId = 10023;//急救箱物品ID
|
||||
public const int GameToMapNeedCopper = 5;//传送每海里费用
|
||||
public const int TeamCacheTime = 300;//队伍缓存时间
|
||||
public const int GameEquApprGoods = 10001;//鉴定装备道具
|
||||
public const int GameEquApprGoods = 10019;//鉴定装备道具
|
||||
}
|
||||
@@ -59,6 +59,7 @@ public static class GameEnum
|
||||
MapTo,
|
||||
Store,
|
||||
Make,
|
||||
Exchange,
|
||||
}
|
||||
|
||||
public enum DicCode
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public interface IExchangeService
|
||||
{
|
||||
Task<List<game_exchange>> GetExchangeData(int npcId);
|
||||
Task<game_exchange> GetExchangeInfo(int exId);
|
||||
Task<int> GetExchangeCount(string userId, int exId);
|
||||
Task<bool> AddUserExchangeLog(string userId, int exId, int count, long endTime);
|
||||
}
|
||||
@@ -18,7 +18,7 @@ public interface IGameEquService
|
||||
Task<List<unit_user_equ>> GetUserEquData(string userId, string code, List<string> noUeId);
|
||||
Task<unit_user_equ> GetUserEquInfo(string ueId);
|
||||
Task<int> GetUserEquByEquIdCount(string userId, int equId);
|
||||
Task<List<unit_user_equ>> GetUserEquByEquId(string userId, int equId);
|
||||
Task<List<unit_user_equ>> GetUserEquByEquIdToDeduct(string userId, int equId);
|
||||
Task<bool> AddUserEqu(string userId, int equId, int count, string remark);
|
||||
Task<bool> AddUserEqu(unit_user_equ equData, string remark);
|
||||
Task<unit_user_equ> AddUserEqu(string userId, int equId, bool rdAttr = false, string remark = "");
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public class ExchangeService(ISqlSugarClient DbClient, IRedisCache redis) : IExchangeService, ITransient
|
||||
{
|
||||
public async Task<List<game_exchange>> GetExchangeData(int npcId)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<game_exchange>();
|
||||
var data = await db.Queryable<game_exchange>().Where(it => it.npcId == npcId).ToListAsync();
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<game_exchange> GetExchangeInfo(int exId)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<game_exchange>();
|
||||
return await db.Queryable<game_exchange>().Where(it => it.exId == exId).SingleAsync();
|
||||
}
|
||||
|
||||
public async Task<int> GetExchangeCount(string userId, int exId)
|
||||
{
|
||||
int result = 0;
|
||||
string key = $"{userId}_{exId}";
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<game_exchange_log>();
|
||||
return await db.Queryable<game_exchange_log>().Where(it => it.userId == userId && it.exId == exId)
|
||||
.SumAsync(it => (int)it.count);
|
||||
}
|
||||
|
||||
public async Task<bool> AddUserExchangeLog(string userId, int exId, int count,long endTime)
|
||||
{
|
||||
game_exchange_log log = new game_exchange_log();
|
||||
log.ueId = StringAssist.NewGuid;
|
||||
log.userId = userId;
|
||||
log.exId = exId;
|
||||
log.count = count;
|
||||
log.addTime = TimeExtend.GetTimeStampSeconds;
|
||||
log.endTime = endTime;
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<game_exchange_log>();
|
||||
bool result = await db.Insertable(log).ExecuteCommandAsync() > 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -78,16 +78,21 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
public async Task<int> GetUserEquByEquIdCount(string userId, int equId)
|
||||
{
|
||||
int result = 0;
|
||||
var data = await GetUserEquByEquId(userId, equId);
|
||||
var data = await GetUserEquData(userId, equId);
|
||||
result = data.Count;
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<List<unit_user_equ>> GetUserEquByEquId(string userId, int equId)
|
||||
public async Task<List<unit_user_equ>> GetUserEquByEquIdToDeduct(string userId, int equId)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
|
||||
return await db.Queryable<unit_user_equ>().Where(i => i.userId == userId && i.equId == equId).ToListAsync();
|
||||
var userEqu = await GetUserEquData(userId, equId);
|
||||
userEqu = userEqu.FindAll(it => it.isLock == 0 && it.isOn == 0);
|
||||
userEqu = userEqu.OrderBy(it => (int)it.intensifyLev)
|
||||
.ThenBy(it => it.quality)
|
||||
.ToList();
|
||||
return userEqu;
|
||||
}
|
||||
|
||||
|
||||
public async Task<bool> AddUserEqu(string userId, int equId, int count, string remark)
|
||||
{
|
||||
@@ -358,21 +363,11 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
|
||||
public async Task<bool> DeductUserEqu(string userId, int equId, int count, string remark)
|
||||
{
|
||||
var userEqu = await GetUserEquData(userId, equId);
|
||||
var userEqu = await GetUserEquByEquIdToDeduct(userId, equId);
|
||||
if (userEqu.Count < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
userEqu = userEqu.FindAll(it => it.isLock == 0 && it.isOn == 0);
|
||||
if (userEqu.Count < count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
userEqu = userEqu.OrderBy(it => (int)it.intensifyLev)
|
||||
.OrderBy(it => it.quality)
|
||||
.ToList();
|
||||
var opData = userEqu.Take(count).ToList();
|
||||
return await DeductUserEqu(userId, opData, remark);
|
||||
}
|
||||
|
||||
@@ -48,42 +48,42 @@ public class EquTool
|
||||
return onAttr;
|
||||
}
|
||||
|
||||
int result = onLev * 3;
|
||||
result = result > 57 ? 57 : result;
|
||||
int result = onLev;
|
||||
result = result > 19 ? 19 : result;
|
||||
|
||||
if (onLev > 19)
|
||||
{
|
||||
int addLev = onLev - 19;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
result += addLev * 5;
|
||||
result += addLev * 3;
|
||||
}
|
||||
|
||||
if (onLev > 29)
|
||||
{
|
||||
int addLev = onLev - 29;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
result += addLev * 10;
|
||||
result += addLev * 5;
|
||||
}
|
||||
|
||||
if (onLev > 39)
|
||||
{
|
||||
int addLev = onLev - 39;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
result += addLev * 15;
|
||||
result += addLev * 10;
|
||||
}
|
||||
|
||||
if (onLev > 49)
|
||||
{
|
||||
int addLev = onLev - 49;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
result += addLev * 20;
|
||||
result += addLev * 15;
|
||||
}
|
||||
|
||||
if (onLev > 59)
|
||||
{
|
||||
int addLev = onLev - 59;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
result += addLev * 25;
|
||||
result += addLev * 20;
|
||||
}
|
||||
|
||||
if (onLev > 69)
|
||||
@@ -91,7 +91,7 @@ public class EquTool
|
||||
int addLev = onLev - 69;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
int unitAdd = Convert.ToInt32(onAttr * 0.05);
|
||||
unitAdd = unitAdd < 30 ? 30 : unitAdd;
|
||||
unitAdd = unitAdd < 25 ? 25 : unitAdd;
|
||||
result += addLev * unitAdd;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class EquTool
|
||||
int addLev = onLev - 79;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
int unitAdd = Convert.ToInt32(onAttr * 0.1);
|
||||
unitAdd = unitAdd < 35 ? 35 : unitAdd;
|
||||
unitAdd = unitAdd < 30 ? 30 : unitAdd;
|
||||
result += addLev * unitAdd;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class EquTool
|
||||
int addLev = onLev - 89;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
int unitAdd = Convert.ToInt32(onAttr * 0.15);
|
||||
unitAdd = unitAdd < 40 ? 40 : unitAdd;
|
||||
unitAdd = unitAdd < 35 ? 35 : unitAdd;
|
||||
result += addLev * unitAdd;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,8 @@ public static class GameBus
|
||||
if (item.code == nameof(GameEnum.PropCode.Equ))
|
||||
{
|
||||
var equService = App.GetService<IGameEquService>();
|
||||
int MyCount = await equService.GetUserEquByEquIdCount(userId, Convert.ToInt32(item.parameter));
|
||||
var myOpEqu = await equService.GetUserEquByEquIdToDeduct(userId, Convert.ToInt32(item.parameter));
|
||||
int MyCount = myOpEqu.Count;
|
||||
long needCount = item.count * count;
|
||||
item.count = needCount;
|
||||
item.onCount = MyCount;
|
||||
|
||||
Reference in New Issue
Block a user