12121
This commit is contained in:
12
Service/Application.Domain.Entity/model/FightResultModel.cs
Normal file
12
Service/Application.Domain.Entity/model/FightResultModel.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace Application.Domain.Entity;
|
||||
|
||||
public class FightResultModel
|
||||
{
|
||||
public int result { get; set; }
|
||||
public int myHarm { get; set; }
|
||||
public int otHarm { get; set; }
|
||||
public List<string> myStateData { get; set; }
|
||||
public List<dynamic> myRemData { get; set; }
|
||||
public List<string> otStateData { get; set; }
|
||||
public List<dynamic> otRemData { get; set; }
|
||||
}
|
||||
@@ -4,7 +4,8 @@ public static class UserEnum
|
||||
{
|
||||
public enum AttrCode
|
||||
{
|
||||
Person
|
||||
Person,
|
||||
Monster
|
||||
}
|
||||
|
||||
public enum ConfigCode
|
||||
|
||||
@@ -9,9 +9,8 @@ public interface IGameFightService
|
||||
#endregion
|
||||
#region 战斗信息
|
||||
Task<game_fight_data> GetFightInfo(string fightId);
|
||||
Task<long> GetFightBlood(string keyId, long maxBlood);
|
||||
Task SetFightBlood(string keyId, long blood);
|
||||
Task AddFightHarm(string fightId, string userId, long harm);
|
||||
Task RemoveFightHarm(string fightId, string userId);
|
||||
Task<bool> AddFight(string fightId, string areaCode, string keyId, string mainId, string code,
|
||||
string scene, string mapId,
|
||||
string userId, long exp = 0, long copper = 0, long petExp = 0, string award = "", string pars = "");
|
||||
|
||||
@@ -16,5 +16,13 @@ public interface IGameMonsterService
|
||||
Task<unit_user_monster> GetCreateMonsterInfo(string umId);
|
||||
Task<List<MapMonsterModel>> GetMapMonster(string userId, string mapId, string teamId);
|
||||
|
||||
#endregion
|
||||
|
||||
#region 怪物模型
|
||||
|
||||
Task<UserAttrModel> GetMonsterAttrModel(string keyId, string monsterId);
|
||||
Task SetMonsterBlood(string keyId, int blood);
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -54,28 +54,6 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<long> GetFightBlood(string keyId, long maxBlood)
|
||||
{
|
||||
long blood = maxBlood;
|
||||
string key = string.Format(FightCache.FightCacheKeys, "FightData:Blood", keyId);
|
||||
if (await redis.ExistsAsync(key))
|
||||
{
|
||||
blood = await redis.GetAsync<long>(key);
|
||||
blood = blood > maxBlood ? maxBlood : blood;
|
||||
}
|
||||
else
|
||||
{
|
||||
await SetFightBlood(keyId, blood);
|
||||
}
|
||||
|
||||
return blood;
|
||||
}
|
||||
|
||||
public async Task SetFightBlood(string keyId, long blood)
|
||||
{
|
||||
string key = string.Format(FightCache.FightCacheKeys, "FightData:Blood", keyId);
|
||||
await redis.SetAsync(key, blood, 43200);
|
||||
}
|
||||
|
||||
public async Task AddFightHarm(string fightId,string userId, long harm)
|
||||
{
|
||||
@@ -91,6 +69,12 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
||||
await redis.AddHashAsync(key, userId, harm);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task RemoveFightHarm(string fightId,string userId)
|
||||
{
|
||||
string key = string.Format(FightCache.FightCacheKeys, "FightData:Harm", fightId);
|
||||
await redis.DelHashAsync(key, userId);
|
||||
}
|
||||
|
||||
|
||||
private async Task ClearFightInfoCache(string fightId, string keyId)
|
||||
|
||||
@@ -204,4 +204,66 @@ public class GameMonsterService(ISqlSugarClient DbClient, IRedisCache redis) : I
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 怪物模型
|
||||
|
||||
public async Task<UserAttrModel> GetMonsterAttrModel(string keyId,string monsterId)
|
||||
{
|
||||
UserAttrModel temp = new UserAttrModel();
|
||||
var monsterInfo = await GetMonsterInfo(monsterId);
|
||||
if (monsterInfo != null)
|
||||
{
|
||||
temp.id = keyId;
|
||||
temp.viceId = monsterId;
|
||||
temp.name = monsterInfo.name;
|
||||
temp.IsSystem = 1;
|
||||
temp.isCopy = (int)monsterInfo.isCopy;
|
||||
temp.sex = "Default";
|
||||
temp.code = nameof(UserEnum.AttrCode.Monster);
|
||||
temp.lev = (int)monsterInfo.lev;
|
||||
temp.minAtk = (int)monsterInfo.minAtk;
|
||||
temp.maxAtk = (int)monsterInfo.maxAtk;
|
||||
temp.defense = (int)monsterInfo.defense;
|
||||
temp.agility = (int)monsterInfo.agility;
|
||||
temp.upBlood = (int)monsterInfo.blood;
|
||||
temp.upMorale = 1;
|
||||
temp.morale = 0;
|
||||
temp = GameAttrTool.GetRoleAttrTempMerge(temp, monsterInfo.attr);
|
||||
temp.score = 0;
|
||||
|
||||
//处理负面
|
||||
var attrService = App.GetService<IUnitUserAttrService>();
|
||||
var loadState = await attrService.GetUserLoadState(keyId);
|
||||
temp = await GameAttrTool.CheckRoleLoadBuff(temp, loadState);
|
||||
temp.blood = await GetMonsterBlood(keyId, temp.upBlood);
|
||||
}
|
||||
|
||||
return temp;
|
||||
}
|
||||
private async Task<int> GetMonsterBlood(string keyId, int maxBlood)
|
||||
{
|
||||
int blood = maxBlood;
|
||||
blood = blood < 0 ? 0 : blood;
|
||||
string key = string.Format(FightCache.FightCacheKeys, "FightData:Blood", keyId);
|
||||
if (await redis.ExistsAsync(key))
|
||||
{
|
||||
blood = await redis.GetAsync<int>(key);
|
||||
blood = blood > maxBlood ? maxBlood : blood;
|
||||
blood = blood < 0 ? 0 : blood;
|
||||
}
|
||||
else
|
||||
{
|
||||
await SetMonsterBlood(keyId, blood);
|
||||
}
|
||||
|
||||
return blood;
|
||||
}
|
||||
|
||||
public async Task SetMonsterBlood(string keyId, int blood)
|
||||
{
|
||||
string key = string.Format(FightCache.FightCacheKeys, "FightData:Blood", keyId);
|
||||
await redis.SetAsync(key, blood, 43200);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -778,6 +778,7 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
|
||||
{
|
||||
data.Remove(onData);
|
||||
onData.count += 1;
|
||||
onData.count = onData.count > 10 ? 10 : onData.count;
|
||||
result = await redis.AddHashAsync(key, userId, data);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ public class UnitUserWeight(ISqlSugarClient DbClient, IRedisCache redis) : IUnit
|
||||
{
|
||||
int result = 100 + (int)data.maxWeight;
|
||||
var attrService = App.GetService<IUnitUserAttrService>();
|
||||
int myLev = await attrService.GetUserLev(data.userId);
|
||||
result += myLev * GameConfig.UpLevAddWeight;
|
||||
//其他属性加层
|
||||
var userAttr = await attrService.GetUserAttrModel(data.userId);
|
||||
result += userAttr.lev * GameConfig.UpLevAddWeight;
|
||||
result += userAttr.weight;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -227,11 +227,6 @@ public class GameAttrTool
|
||||
decimal radio = item.count * 0.04M;
|
||||
temp.defense = Convert.ToInt32(temp.defense * (1.0M - radio));
|
||||
}
|
||||
else if (item.code == nameof(GameEnum.AttrCode.PalsyAtk))
|
||||
{
|
||||
decimal radio = item.count * 0.1M;
|
||||
temp.Atk_Next -= radio;
|
||||
}
|
||||
}
|
||||
|
||||
return temp;
|
||||
|
||||
11
Service/Application.Domain/Tool/Base/UserStateTool.cs
Normal file
11
Service/Application.Domain/Tool/Base/UserStateTool.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public static class UserStateTool
|
||||
{
|
||||
public static async Task<bool> CheckUserFight(string userId)
|
||||
{
|
||||
var fightService = App.GetService<IGameFightService>();
|
||||
var myFight = await fightService.GetUserFight(userId);
|
||||
return myFight.Count > 0;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Application.Service.Pub
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class MapController : ControllerBase
|
||||
public MapController(IUnitUserService userService, IGameMapService mapService, IGameChatService chatService,
|
||||
IUnitUserAttrService attrService, IMessageService messageService, IUnitUserWeight weightService,
|
||||
IUnitUserAccService accService, IGameSkillService skillService, IGameGoodsService goodsService,
|
||||
IGameTeamService teamService, IGameMonsterService monsterService,IGameFightService fightService)
|
||||
IGameTeamService teamService, IGameMonsterService monsterService, IGameFightService fightService)
|
||||
{
|
||||
_userService = userService;
|
||||
_mapService = mapService;
|
||||
@@ -55,6 +55,7 @@ public class MapController : ControllerBase
|
||||
{
|
||||
string userId = StateHelper.userId;
|
||||
int area = StateHelper.areaId;
|
||||
string gameTips = string.Empty;
|
||||
game_city_map mapInfo = new game_city_map();
|
||||
|
||||
#region 前置条件处理
|
||||
@@ -79,6 +80,7 @@ public class MapController : ControllerBase
|
||||
//设置默认地图点
|
||||
await _mapService.SetUserMapDefult(userId);
|
||||
isSelfMap = true;
|
||||
gameTips = "➢当前体力为0,恢复一下吧!";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +147,7 @@ public class MapController : ControllerBase
|
||||
|
||||
var userFight = await _fightService.GetUserFight(userId);
|
||||
string fightId = userFight.Count > 0 ? userFight[0] : "";
|
||||
|
||||
|
||||
object ret = new
|
||||
{
|
||||
mapInfo,
|
||||
@@ -159,7 +161,8 @@ public class MapController : ControllerBase
|
||||
mapRes,
|
||||
broadcast,
|
||||
monster = monsterData,
|
||||
fightId
|
||||
fightId,
|
||||
gameTips
|
||||
};
|
||||
|
||||
return PoAction.Ok(ret);
|
||||
|
||||
@@ -15,14 +15,19 @@ public class FightController : ControllerBase
|
||||
private readonly IGameMonsterService _monsterService;
|
||||
private readonly IUnitUserAttrService _attrService;
|
||||
private readonly IGameMapService _mapService;
|
||||
private readonly IUnitUserAccService _accService;
|
||||
private readonly IGameGoodsService _goodsService;
|
||||
|
||||
public FightController(IGameFightService fightService, IGameMonsterService monsterService,
|
||||
IUnitUserAttrService attrService, IGameMapService mapService)
|
||||
IUnitUserAttrService attrService, IGameMapService mapService, IUnitUserAccService accService,
|
||||
IGameGoodsService goodsService)
|
||||
{
|
||||
_fightService = fightService;
|
||||
_monsterService = monsterService;
|
||||
_attrService = attrService;
|
||||
_mapService = mapService;
|
||||
_accService = accService;
|
||||
_goodsService = goodsService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -68,20 +73,21 @@ public class FightController : ControllerBase
|
||||
areaCode = monster.areaCode;
|
||||
pars = JsonConvert.SerializeObject(new { type = "Create", code = monster.code, par = monster.par });
|
||||
}
|
||||
|
||||
var monsterInfo = await _monsterService.GetMonsterInfo(mainId);
|
||||
if (monsterInfo != null)
|
||||
{
|
||||
var userAttr = await _attrService.GetUserAttrModel(userId, scene);
|
||||
//处理奖励和资源
|
||||
exp = Convert.ToInt64(monsterInfo.exp * (1.0m + userAttr.addExp)) ;
|
||||
exp = Convert.ToInt64(monsterInfo.exp * (1.0m + userAttr.addExp));
|
||||
copper = Convert.ToInt64(monsterInfo.copper * (1.0m + userAttr.addGold));
|
||||
petExp = (long)monsterInfo.petExp;
|
||||
if (!string.IsNullOrEmpty(monsterInfo.award))//生成奖励
|
||||
if (!string.IsNullOrEmpty(monsterInfo.award)) //生成奖励
|
||||
{
|
||||
var awardModel = JsonConvert.DeserializeObject<MonsterAwardModel>(monsterInfo.award);
|
||||
if (awardModel.type == nameof(MonsterEnum.AwardCode.Default))
|
||||
{
|
||||
var getAward = GameBus.GetRandomGoods(awardModel.award, 1,userAttr.burst);
|
||||
var getAward = GameBus.GetRandomGoods(awardModel.award, 1, userAttr.burst);
|
||||
award = JsonConvert.SerializeObject(new FightAwardModel() { code = "Default", award = getAward });
|
||||
}
|
||||
}
|
||||
@@ -99,9 +105,257 @@ public class FightController : ControllerBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 战斗接口
|
||||
/// </summary>
|
||||
/// <param name="parms"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IPoAction> Fight([FromBody] FightParms parms)
|
||||
{
|
||||
return PoAction.Ok(true);
|
||||
string userId = StateHelper.userId;
|
||||
string fightId = parms.fightId;
|
||||
int myHarm = 0;
|
||||
int otHarm = 0;
|
||||
var myFight = await _fightService.GetUserFight(userId);
|
||||
if (myFight.Any(it => it == fightId) == false)
|
||||
{
|
||||
return PoAction.Message("战斗不存在!");
|
||||
}
|
||||
|
||||
var fight = await _fightService.GetFightInfo(fightId);
|
||||
if (fight == null)
|
||||
{
|
||||
await _fightService.RemoveUserFight(userId, fightId);
|
||||
return PoAction.Message("战斗不存在!");
|
||||
}
|
||||
|
||||
if (fight.state == 1)
|
||||
{
|
||||
await _fightService.RemoveUserFight(userId, fightId);
|
||||
return PoAction.Message("战斗结束", 100);
|
||||
}
|
||||
|
||||
#region 此处处理战斗
|
||||
|
||||
FightResultModel fightResult = new FightResultModel()
|
||||
{
|
||||
result = -1
|
||||
};
|
||||
if (!string.IsNullOrEmpty(parms.data))
|
||||
{
|
||||
fightResult = JsonConvert.DeserializeObject<FightResultModel>(parms.data);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
//更新攻击
|
||||
if (fightResult.result == 0)
|
||||
{
|
||||
myHarm = fightResult.myHarm;
|
||||
otHarm = fightResult.otHarm;
|
||||
await _attrService.UpdateUserBlood(userId, 1, fightResult.myHarm);
|
||||
}
|
||||
var myAttr = await _attrService.GetUserAttrModel(userId, fight.scene);
|
||||
UserAttrModel otAttr = new UserAttrModel();
|
||||
if (fight.code == nameof(GameEnum.FightCode.PVE))
|
||||
{
|
||||
otAttr = await _monsterService.GetMonsterAttrModel(fight.keyId, fight.mainId);
|
||||
if (fightResult.result == 0)
|
||||
{
|
||||
otAttr.blood = otAttr.blood + fightResult.otHarm;
|
||||
otAttr.blood = otAttr.blood < 0 ? 0 : otAttr.blood;
|
||||
otAttr.blood = otAttr.blood > otAttr.upBlood ? otAttr.upBlood : otAttr.blood;
|
||||
await _monsterService.SetMonsterBlood(fight.keyId, otAttr.blood);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
otAttr = await _attrService.GetUserAttrModel(fight.mainId, fight.scene);
|
||||
if (fightResult.result == 0)
|
||||
{
|
||||
await _attrService.UpdateUserBlood(fight.mainId, 1, fightResult.otHarm);
|
||||
}
|
||||
}
|
||||
|
||||
//结束战斗都此处直接返回
|
||||
if (otAttr.blood < 1||myAttr.blood<1)
|
||||
{
|
||||
await _fightService.RemoveUserFight(userId, fightId);
|
||||
return PoAction.Message("战斗结束", 100);
|
||||
}
|
||||
//获取个人药品栏
|
||||
var myDrug = await _attrService.GetUserDrug(userId);
|
||||
//获取个人负面
|
||||
var myLoad = await _attrService.GetUserLoadState(userId);
|
||||
|
||||
//冷却时间
|
||||
int cool = 1000;
|
||||
if (myAttr.agility > otAttr.agility&&otAttr.agility>0)
|
||||
{
|
||||
decimal diff = myAttr.agility - otAttr.agility;
|
||||
decimal bl = diff / otAttr.agility;
|
||||
cool = Convert.ToInt32(bl * 1000.0m);
|
||||
cool = cool > 1000 ? 1000 : cool;
|
||||
}
|
||||
|
||||
//麻痹状态增加冷却时间
|
||||
var atkCoolData = myLoad.Find(it => it.code == nameof(GameEnum.AttrCode.PalsyAtk));
|
||||
if (atkCoolData != null)
|
||||
{
|
||||
cool = Convert.ToInt32(cool * (1 + atkCoolData.count * 0.1M));
|
||||
}
|
||||
|
||||
//更新伤害提示
|
||||
|
||||
|
||||
int exitCopper = otAttr.lev * 5;
|
||||
var result = new
|
||||
{
|
||||
myHarm,
|
||||
otHarm,
|
||||
myAttr = myAttr,
|
||||
otAttr = otAttr,
|
||||
myDrug = myDrug.drug,
|
||||
myLoad = myLoad,
|
||||
exitCopper,
|
||||
cool,
|
||||
};
|
||||
return PoAction.Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 退出战斗
|
||||
/// </summary>
|
||||
/// <param name="fightId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> Exit(string fightId)
|
||||
{
|
||||
string userId = StateHelper.userId;
|
||||
var myFight = await _fightService.GetUserFight(userId);
|
||||
if (myFight.Any(it => it == fightId) == false)
|
||||
{
|
||||
return PoAction.Message("战斗不存在!");
|
||||
}
|
||||
|
||||
var fight = await _fightService.GetFightInfo(fightId);
|
||||
if (fight == null)
|
||||
{
|
||||
await _fightService.RemoveUserFight(userId, fightId);
|
||||
return PoAction.Message("战斗不存在!");
|
||||
}
|
||||
|
||||
if (fight.state == 1)
|
||||
{
|
||||
await _fightService.RemoveUserFight(userId, fightId);
|
||||
return PoAction.Message("战斗结束", 100);
|
||||
}
|
||||
|
||||
UserAttrModel otAttr = new UserAttrModel();
|
||||
if (fight.code == nameof(GameEnum.FightCode.PVE))
|
||||
{
|
||||
otAttr = await _monsterService.GetMonsterAttrModel(fight.keyId, fight.mainId);
|
||||
}
|
||||
else
|
||||
{
|
||||
otAttr = await _attrService.GetUserAttrModel(fight.mainId, fight.scene);
|
||||
}
|
||||
|
||||
int needCopper = otAttr.lev * 5;
|
||||
var myAcc = await _accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
|
||||
if (myAcc < needCopper)
|
||||
{
|
||||
return PoAction.Message("铜贝不足!", 101);
|
||||
}
|
||||
|
||||
if (await _accService.UpdateUserCopper(userId, 0, needCopper, "退出战斗"))
|
||||
{
|
||||
if (await _fightService.RemoveUserFight(userId, fightId))
|
||||
{
|
||||
await _fightService.RemoveFightHarm(fightId, userId); //移除伤害
|
||||
var nextFight = myFight.FindAll(it => it != fightId);
|
||||
string nextId = nextFight.Count > 0 ? nextFight[0] : "";
|
||||
return PoAction.Ok(nextId);
|
||||
}
|
||||
else
|
||||
{
|
||||
return PoAction.Message("退出失败,请稍后尝试!", 101);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return PoAction.Message("退出失败,请稍后尝试!", 101);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用药品
|
||||
/// </summary>
|
||||
/// <param name="fightId"></param>
|
||||
/// <param name="drugId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> UseFightDrug(string fightId, string drugId)
|
||||
{
|
||||
string userId = StateHelper.userId;
|
||||
var myFight = await _fightService.GetUserFight(userId);
|
||||
if (myFight.Any(it => it == fightId) == false)
|
||||
{
|
||||
return PoAction.Message("战斗不存在!");
|
||||
}
|
||||
var fight = await _fightService.GetFightInfo(fightId);
|
||||
if (fight == null)
|
||||
{
|
||||
await _fightService.RemoveUserFight(userId, fightId);
|
||||
return PoAction.Message("战斗不存在!");
|
||||
}
|
||||
|
||||
if (fight.state == 1)
|
||||
{
|
||||
await _fightService.RemoveUserFight(userId, fightId);
|
||||
return PoAction.Message("战斗结束!");
|
||||
}
|
||||
|
||||
var myDrug = await _attrService.GetUserDrug(userId);
|
||||
var onDrug = myDrug.drug.Find(it => it.id == drugId);
|
||||
if (onDrug == null)
|
||||
{
|
||||
return PoAction.Message("药品不存在!");
|
||||
}
|
||||
|
||||
if (onDrug.count < 1)
|
||||
{
|
||||
return PoAction.Message("药品不足!");
|
||||
}
|
||||
|
||||
var drugConfig = await _goodsService.GetGoodsContent(onDrug.goodsId);
|
||||
string check = await _goodsService.CheckUseDrug(userId, onDrug.goodsId, drugConfig, fightId);
|
||||
if (!string.IsNullOrEmpty(check))
|
||||
{
|
||||
return PoAction.Message(check);
|
||||
}
|
||||
|
||||
foreach (var item in myDrug.drug)
|
||||
{
|
||||
if (item.id == drugId)
|
||||
{
|
||||
item.count = item.count - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (await _attrService.UpdateUserDrug(myDrug))
|
||||
{
|
||||
await _goodsService.UseDrug(userId, onDrug.goodsId, drugConfig, fightId);
|
||||
return PoAction.Ok("药品使用成功!");
|
||||
}
|
||||
else
|
||||
{
|
||||
return PoAction.Message("药品使用失败!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,11 @@ public class GoodsController : ControllerBase
|
||||
|
||||
if (goodsInfo.code == nameof(GoodsEnum.Code.Drug))
|
||||
{
|
||||
if (await UserStateTool.CheckUserFight(userId))
|
||||
{
|
||||
return PoAction.Message($"战斗状态下无法使用!");
|
||||
}
|
||||
|
||||
var ck = await _goodsService.CheckUseDrug(userId, goodsId, goodsInfo.content);
|
||||
if (!string.IsNullOrEmpty(ck))
|
||||
{
|
||||
|
||||
@@ -14,13 +14,15 @@ namespace Application.Web.Controllers.Pub
|
||||
private readonly INoticeService _noticeService;
|
||||
private readonly IGameAccountService _accountService;
|
||||
private readonly IUnitUserService _userService;
|
||||
private readonly IGameMonsterService _monsterService;
|
||||
|
||||
public PubController(IAreaService areaService, INoticeService noticeService, IGameAccountService accountService,IUnitUserService userService)
|
||||
public PubController(IAreaService areaService, INoticeService noticeService, IGameAccountService accountService,IUnitUserService userService,IGameMonsterService monsterService)
|
||||
{
|
||||
_areaService = areaService;
|
||||
_noticeService = noticeService;
|
||||
_accountService = accountService;
|
||||
_userService = userService;
|
||||
_monsterService = monsterService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -134,5 +136,21 @@ namespace Application.Web.Controllers.Pub
|
||||
return PoAction.Ok(areaInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 怪物信息
|
||||
/// </summary>
|
||||
/// <param name="monsterId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> GetMonsterInfo(string monsterId)
|
||||
{
|
||||
var monster = await _monsterService.GetMonsterInfo(monsterId);
|
||||
if (monster == null)
|
||||
{
|
||||
return PoAction.Message("怪物不存在!");
|
||||
}
|
||||
|
||||
return PoAction.Ok(monster);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,4 +3,5 @@
|
||||
public class FightParms
|
||||
{
|
||||
public string fightId { get; set; }
|
||||
public string data { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user