111
This commit is contained in:
@@ -0,0 +1,69 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Application.Domain.Entity
|
||||||
|
{
|
||||||
|
[Tenant("Kg.SeaTime.Game")]
|
||||||
|
public class unit_user_monster
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// umId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true, Length = 50)]
|
||||||
|
public string umId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// userId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? userId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// areaCode
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 255, IsNullable = true)]
|
||||||
|
public string? areaCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// mapId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? mapId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// monsterId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? monsterId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// monsterName
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? monsterName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// code
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// par
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 255, IsNullable = true)]
|
||||||
|
public string? par { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// addTime
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public long? addTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// endTime
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public long? endTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Service/Application.Domain.Entity/model/MapMonsterModel.cs
Normal file
11
Service/Application.Domain.Entity/model/MapMonsterModel.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
namespace Application.Domain.Entity;
|
||||||
|
|
||||||
|
public class MapMonsterModel
|
||||||
|
{
|
||||||
|
public string monterId { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 0地图怪物 1生成怪物
|
||||||
|
/// </summary>
|
||||||
|
public int type { get; set; }
|
||||||
|
}
|
||||||
117
Service/Application.Domain.Entity/resource/game/game_monster.cs
Normal file
117
Service/Application.Domain.Entity/resource/game/game_monster.cs
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Application.Domain.Entity
|
||||||
|
{
|
||||||
|
[Tenant("Kg.SeaTime.Resource")]
|
||||||
|
public class game_monster
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// monsterId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true, Length = 50)]
|
||||||
|
public string monsterId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// name
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 怪物应用区域
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// lev
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? lev { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// exp
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public long? exp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// copper
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public long? copper { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// petExp
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public long? petExp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// minAtk
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? minAtk { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// maxAtk
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? maxAtk { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// defense
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? defense { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// agility
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? agility { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// blood
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 62, IsNullable = true)]
|
||||||
|
public decimal? blood { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 怪物属性
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true,IsJson = true)]
|
||||||
|
public List<AttrItem> attr { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 怪物技能
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public string? skill { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// award
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 3000, IsNullable = true)]
|
||||||
|
public string? award { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 支持复制战斗0不支持 1支持
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? isCopy { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 怪物说明
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 255, IsNullable = true)]
|
||||||
|
public string? remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用于后台操作标记,无其他作用
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 255, IsNullable = true)]
|
||||||
|
public string? markTips { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Application.Domain.Entity
|
||||||
|
{
|
||||||
|
[Tenant("Kg.SeaTime.Resource")]
|
||||||
|
public class game_monster_map
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// mmId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true, Length = 50)]
|
||||||
|
public string mmId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// mapId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? mapId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// monsterId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? monsterId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// monsterName
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? monsterName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// addCount
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? addCount { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// chance
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? chance { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// sTime
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? sTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// eTime
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? eTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
15
Service/Application.Domain/Enum/MonsterEnum.cs
Normal file
15
Service/Application.Domain/Enum/MonsterEnum.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
|
public static class MonsterEnum
|
||||||
|
{
|
||||||
|
public enum Code
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public enum AreaCode
|
||||||
|
{
|
||||||
|
Own,//个人怪物
|
||||||
|
Public,//公共怪物
|
||||||
|
Team,//队伍怪物
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ public interface IGameEquService
|
|||||||
#region 用户装备
|
#region 用户装备
|
||||||
|
|
||||||
Task<List<unit_user_equ>> GetUserEquData(string userId, int type, string equName, int PageIndex, int PageSize,
|
Task<List<unit_user_equ>> GetUserEquData(string userId, int type, string equName, int PageIndex, int PageSize,
|
||||||
RefAsync<int> Total, bool isRemOn = false);
|
RefAsync<int> Total, bool isRemOn = false, bool isRemLock = false);
|
||||||
|
|
||||||
Task<List<unit_user_equ>> GetUserEquData(string userId, int equId);
|
Task<List<unit_user_equ>> GetUserEquData(string userId, int equId);
|
||||||
Task<List<unit_user_equ>> GetUserEquData(string userId, string code, List<string> noUeId);
|
Task<List<unit_user_equ>> GetUserEquData(string userId, string code, List<string> noUeId);
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
|
public interface IGameMonsterService
|
||||||
|
{
|
||||||
|
#region 地图怪物
|
||||||
|
|
||||||
|
Task<List<game_monster_map>> GetMonsterDataByMap(string mapId);
|
||||||
|
|
||||||
|
Task<bool> CreateMonsterToMap(string userId, string mapId, string areaCode, string monsterId,
|
||||||
|
int count = 1, int time = 0, string par = "");
|
||||||
|
|
||||||
|
Task<List<MapMonsterModel>> GetMapMonster(string userId, string mapId, string teamId);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -39,7 +39,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
|||||||
#region 用户装备
|
#region 用户装备
|
||||||
|
|
||||||
public async Task<List<unit_user_equ>> GetUserEquData(string userId, int type, string equName, int PageIndex,
|
public async Task<List<unit_user_equ>> GetUserEquData(string userId, int type, string equName, int PageIndex,
|
||||||
int PageSize, RefAsync<int> Total, bool isRemOn = false)
|
int PageSize, RefAsync<int> Total, bool isRemOn = false, bool isRemLock = false)
|
||||||
{
|
{
|
||||||
long onTime = TimeExtend.GetTimeStampSeconds;
|
long onTime = TimeExtend.GetTimeStampSeconds;
|
||||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
|
||||||
@@ -48,6 +48,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
|||||||
.WhereIF(type == 1, it => it.isOn == 1)
|
.WhereIF(type == 1, it => it.isOn == 1)
|
||||||
.WhereIF(type == 3, it => it.isAppr == 0)
|
.WhereIF(type == 3, it => it.isAppr == 0)
|
||||||
.WhereIF(isRemOn, it => it.isOn == 0)
|
.WhereIF(isRemOn, it => it.isOn == 0)
|
||||||
|
.WhereIF(isRemLock, it => it.isLock == 0)
|
||||||
.WhereIF(!string.IsNullOrEmpty(equName),
|
.WhereIF(!string.IsNullOrEmpty(equName),
|
||||||
it => it.equName.Contains(equName) || it.unitEquName.Contains(equName))
|
it => it.equName.Contains(equName) || it.unitEquName.Contains(equName))
|
||||||
.OrderByDescending(it => it.lev)
|
.OrderByDescending(it => it.lev)
|
||||||
|
|||||||
@@ -0,0 +1,183 @@
|
|||||||
|
using Microsoft.VisualBasic.CompilerServices;
|
||||||
|
|
||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
|
public class GameMonsterService(ISqlSugarClient DbClient, IRedisCache redis) : IGameMonsterService, ITransient
|
||||||
|
{
|
||||||
|
#region 基础资源库
|
||||||
|
|
||||||
|
public async Task<game_monster> GetMonsterInfo(string monsterId)
|
||||||
|
{
|
||||||
|
string key = string.Format(BaseCache.BaseCacheKeys, "MonsterData", "MonsterInfo");
|
||||||
|
if (await redis.HExistsHashAsync(key, monsterId))
|
||||||
|
{
|
||||||
|
return await redis.GetHashAsync<game_monster>(key, monsterId);
|
||||||
|
}
|
||||||
|
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_monster>();
|
||||||
|
var data = await db.Queryable<game_monster>().Where(it => it.monsterId == monsterId).SingleAsync();
|
||||||
|
await redis.AddHashAsync(key, monsterId, data);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 地图怪物
|
||||||
|
|
||||||
|
public async Task<List<game_monster_map>> GetMonsterDataByMap(string mapId)
|
||||||
|
{
|
||||||
|
string key = string.Format(BaseCache.BaseCacheKeys, "MonsterData", "MonsterOnMap");
|
||||||
|
if (await redis.HExistsHashAsync(key, mapId))
|
||||||
|
{
|
||||||
|
return await redis.GetHashAsync<List<game_monster_map>>(key, mapId);
|
||||||
|
}
|
||||||
|
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_monster_map>();
|
||||||
|
var data = await db.Queryable<game_monster_map>().Where(it => it.mapId == mapId).ToListAsync();
|
||||||
|
await redis.AddHashAsync(key, mapId, data);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> CreateMonsterToMap(string userId, string mapId, string areaCode, string monsterId,
|
||||||
|
int count = 1, int time = 0, string par = "")
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
var monsterInfo = await GetMonsterInfo(monsterId);
|
||||||
|
if (monsterInfo != null)
|
||||||
|
{
|
||||||
|
time = time <= 0 ? 7 * 24 * 60 : time;
|
||||||
|
long onTime = TimeExtend.GetTimeStampSeconds;
|
||||||
|
long endTime = onTime + time * 60;
|
||||||
|
List<unit_user_monster> data = new List<unit_user_monster>();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
data.Add(new unit_user_monster()
|
||||||
|
{
|
||||||
|
umId = StringAssist.NewGuid,
|
||||||
|
userId = userId,
|
||||||
|
areaCode = areaCode,
|
||||||
|
mapId = mapId,
|
||||||
|
monsterId = monsterId,
|
||||||
|
monsterName = monsterInfo.name,
|
||||||
|
code = monsterInfo.code,
|
||||||
|
par = par,
|
||||||
|
addTime = onTime,
|
||||||
|
endTime = endTime
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.Count > 0)
|
||||||
|
{
|
||||||
|
var createDb = DbClient.AsTenant().GetConnectionWithAttr<unit_user_monster>();
|
||||||
|
await createDb.Insertable(data).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
await ClearCreateMonster(mapId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<List<unit_user_monster>> GetCreateMonsterByMapId(string mapId)
|
||||||
|
{
|
||||||
|
string key = string.Format(BaseCache.BaseCacheKeys, "MonsterData", "CreateMonsterOnMap");
|
||||||
|
if (await redis.HExistsHashAsync(key, mapId))
|
||||||
|
{
|
||||||
|
return await redis.GetHashAsync<List<unit_user_monster>>(key, mapId);
|
||||||
|
}
|
||||||
|
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_monster>();
|
||||||
|
var data = await db.Queryable<unit_user_monster>().Where(it => it.mapId == mapId).ToListAsync();
|
||||||
|
await redis.AddHashAsync(key, mapId, data);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ClearCreateMonster(string mapId)
|
||||||
|
{
|
||||||
|
string key = string.Format(BaseCache.BaseCacheKeys, "MonsterData", "CreateMonsterOnMap");
|
||||||
|
await redis.DelHashAsync(key, mapId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<MapMonsterModel>> GetMapMonster(string userId, string mapId, string teamId)
|
||||||
|
{
|
||||||
|
List<MapMonsterModel> result = new List<MapMonsterModel>();
|
||||||
|
var mapMonster = await GetMonsterDataByMap(mapId);
|
||||||
|
if (mapMonster.Count > 0)
|
||||||
|
{
|
||||||
|
int random = 0; //此处需要判断用户状态中的几率
|
||||||
|
int onTime = TimeAssist.GetHourNum;
|
||||||
|
foreach (var item in mapMonster)
|
||||||
|
{
|
||||||
|
if (item.sTime < onTime && item.eTime > onTime)
|
||||||
|
{
|
||||||
|
if (RandomAssist.CheakRandom((int)item.chance + random))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < item.addCount; i++)
|
||||||
|
{
|
||||||
|
MapMonsterModel temp = new MapMonsterModel()
|
||||||
|
{
|
||||||
|
monterId = item.mmId,
|
||||||
|
name = item.monsterName,
|
||||||
|
type = 0
|
||||||
|
};
|
||||||
|
result.Add(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//此处追加个人生成怪物
|
||||||
|
List<unit_user_monster> createData = new List<unit_user_monster>();
|
||||||
|
var createMonster = await GetCreateMonsterByMapId(mapId);
|
||||||
|
if (createMonster.Count > 0)
|
||||||
|
{
|
||||||
|
long onTime = TimeExtend.GetTimeStampSeconds;
|
||||||
|
createMonster = createMonster.FindAll(it => it.endTime > onTime);
|
||||||
|
|
||||||
|
createData.AddRange(createMonster.FindAll(it =>
|
||||||
|
it.userId == userId || it.areaCode == nameof(MonsterEnum.AreaCode.Public)));
|
||||||
|
if (!string.IsNullOrEmpty(teamId) && teamId != "0")
|
||||||
|
{
|
||||||
|
var teamService = App.GetService<IGameTeamService>();
|
||||||
|
var teamMember = await teamService.GetTeamMember(teamId);
|
||||||
|
teamMember = teamMember.FindAll(it => it.userId != userId);
|
||||||
|
var onCreate = createMonster.FindAll(it =>
|
||||||
|
teamMember.Any(team =>
|
||||||
|
team.userId == it.userId && it.areaCode == nameof(MonsterEnum.AreaCode.Team)));
|
||||||
|
foreach (var item in onCreate)
|
||||||
|
{
|
||||||
|
if (createData.Any(it => it.umId == item.umId))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
createData.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (createData.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in createData)
|
||||||
|
{
|
||||||
|
MapMonsterModel temp = new MapMonsterModel()
|
||||||
|
{
|
||||||
|
monterId = item.umId,
|
||||||
|
name = item.monsterName,
|
||||||
|
type = 1
|
||||||
|
};
|
||||||
|
result.Add(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -21,9 +21,12 @@ public class MapController : ControllerBase
|
|||||||
private readonly IGameSkillService _skillService;
|
private readonly IGameSkillService _skillService;
|
||||||
private readonly IGameGoodsService _goodsService;
|
private readonly IGameGoodsService _goodsService;
|
||||||
private readonly IGameTeamService _teamService;
|
private readonly IGameTeamService _teamService;
|
||||||
|
private readonly IGameMonsterService _monsterService;
|
||||||
|
|
||||||
public MapController(IUnitUserService userService, IGameMapService mapService, IGameChatService chatService,
|
public MapController(IUnitUserService userService, IGameMapService mapService, IGameChatService chatService,
|
||||||
IUnitUserAttrService attrService, IMessageService messageService, IUnitUserWeight weightService,
|
IUnitUserAttrService attrService, IMessageService messageService, IUnitUserWeight weightService,
|
||||||
IUnitUserAccService accService, IGameSkillService skillService,IGameGoodsService goodsService,IGameTeamService teamService)
|
IUnitUserAccService accService, IGameSkillService skillService, IGameGoodsService goodsService,
|
||||||
|
IGameTeamService teamService, IGameMonsterService monsterService)
|
||||||
{
|
{
|
||||||
_userService = userService;
|
_userService = userService;
|
||||||
_mapService = mapService;
|
_mapService = mapService;
|
||||||
@@ -35,6 +38,7 @@ public class MapController : ControllerBase
|
|||||||
_skillService = skillService;
|
_skillService = skillService;
|
||||||
_goodsService = goodsService;
|
_goodsService = goodsService;
|
||||||
_teamService = teamService;
|
_teamService = teamService;
|
||||||
|
_monsterService = monsterService;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 地图相关
|
#region 地图相关
|
||||||
@@ -89,14 +93,17 @@ public class MapController : ControllerBase
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
//公聊信息
|
//公聊信息
|
||||||
var myTeam = await _teamService.GetUserTeamData(userId);
|
var myTeam = await _teamService.GetUserTeamData(userId);
|
||||||
string teamId =myTeam.teamId ;
|
string teamId = myTeam.teamId;
|
||||||
string groupId = "";
|
string groupId = "";
|
||||||
var chatData = await _chatService.GetChatTop(userId, area, 2, teamId, groupId);
|
var chatData = await _chatService.GetChatTop(userId, area, 2, teamId, groupId);
|
||||||
|
|
||||||
|
|
||||||
var npcData = await _mapService.GetMapNpc(mapInfo.mapId); //NPC信息
|
var npcData = await _mapService.GetMapNpc(mapInfo.mapId); //NPC信息
|
||||||
npcData = npcData.FindAll(it => GameTool.AreaVerify(StateHelper.areaId, it.areaId));
|
npcData = npcData.FindAll(it => GameTool.AreaVerify(StateHelper.areaId, it.areaId));
|
||||||
|
|
||||||
|
//获取怪物
|
||||||
|
var monsterData = await _monsterService.GetMapMonster(userId, mapInfo.mapId, teamId);
|
||||||
var nearUser =
|
var nearUser =
|
||||||
await _mapService.GetMapUser(mapInfo.mapId, area, (int)mapInfo.lookArea, [userId],
|
await _mapService.GetMapUser(mapInfo.mapId, area, (int)mapInfo.lookArea, [userId],
|
||||||
3); //获取附近的人
|
3); //获取附近的人
|
||||||
@@ -145,7 +152,8 @@ public class MapController : ControllerBase
|
|||||||
noReadMsg = noReadMsg[3],
|
noReadMsg = noReadMsg[3],
|
||||||
business,
|
business,
|
||||||
mapRes,
|
mapRes,
|
||||||
broadcast
|
broadcast,
|
||||||
|
monster = monsterData
|
||||||
};
|
};
|
||||||
|
|
||||||
return PoAction.Ok(ret);
|
return PoAction.Ok(ret);
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public class StoreController : ControllerBase
|
|||||||
{
|
{
|
||||||
return PoAction.Message("Npc不存在!");
|
return PoAction.Message("Npc不存在!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!npcInfo.bus.Any(it => it.code == nameof(GameEnum.NpcBusCode.Store)))
|
if (!npcInfo.bus.Any(it => it.code == nameof(GameEnum.NpcBusCode.Store)))
|
||||||
{
|
{
|
||||||
return PoAction.Message("业务不可用!");
|
return PoAction.Message("业务不可用!");
|
||||||
@@ -88,6 +89,7 @@ public class StoreController : ControllerBase
|
|||||||
{
|
{
|
||||||
return PoAction.Message("Npc不存在!");
|
return PoAction.Message("Npc不存在!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!npcInfo.bus.Any(it => it.code == nameof(GameEnum.NpcBusCode.Store)))
|
if (!npcInfo.bus.Any(it => it.code == nameof(GameEnum.NpcBusCode.Store)))
|
||||||
{
|
{
|
||||||
return PoAction.Message("业务不可用!");
|
return PoAction.Message("业务不可用!");
|
||||||
@@ -165,10 +167,12 @@ public class StoreController : ControllerBase
|
|||||||
{
|
{
|
||||||
return PoAction.Message("Npc不存在!");
|
return PoAction.Message("Npc不存在!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!npcInfo.bus.Any(it => it.code == nameof(GameEnum.NpcBusCode.Store)))
|
if (!npcInfo.bus.Any(it => it.code == nameof(GameEnum.NpcBusCode.Store)))
|
||||||
{
|
{
|
||||||
return PoAction.Message("业务不可用!");
|
return PoAction.Message("业务不可用!");
|
||||||
}
|
}
|
||||||
|
|
||||||
var onMap = await _mapService.GetUserOnMapId(userId);
|
var onMap = await _mapService.GetUserOnMapId(userId);
|
||||||
if (npcInfo.mapId != onMap)
|
if (npcInfo.mapId != onMap)
|
||||||
{
|
{
|
||||||
@@ -179,25 +183,25 @@ public class StoreController : ControllerBase
|
|||||||
|
|
||||||
if (type == 0)
|
if (type == 0)
|
||||||
{
|
{
|
||||||
var data = await _equService.GetUserEquData(userId, 0, query, page, 10, total, true);
|
var data = await _equService.GetUserEquData(userId, 0, query, page, 10, total, true, true);
|
||||||
return PoAction.Ok(new { data, total.Value });
|
return PoAction.Ok(new { data, total = total.Value });
|
||||||
}
|
}
|
||||||
else if (type == 1)
|
else if (type == 1)
|
||||||
{
|
{
|
||||||
List<string> code = new List<string>() { nameof(GoodsEnum.Code.Drug) };
|
List<string> code = new List<string>() { nameof(GoodsEnum.Code.Drug) };
|
||||||
var data = await _goodsService.GetUserGoodsData(userId, code, new List<string>(), query, page, 10, total);
|
var data = await _goodsService.GetUserGoodsData(userId, code, new List<string>(), query, page, 10, total);
|
||||||
return PoAction.Ok(new { data, total.Value });
|
return PoAction.Ok(new { data, total = total.Value });
|
||||||
}
|
}
|
||||||
else if (type == 2)
|
else if (type == 2)
|
||||||
{
|
{
|
||||||
List<string> code = new List<string>();
|
List<string> code = new List<string>();
|
||||||
List<string> noCode = new List<string>() { nameof(GoodsEnum.Code.Drug) };
|
List<string> noCode = new List<string>() { nameof(GoodsEnum.Code.Drug) };
|
||||||
var data = await _goodsService.GetUserGoodsData(userId, code, noCode, query, page, 10, total);
|
var data = await _goodsService.GetUserGoodsData(userId, code, noCode, query, page, 10, total);
|
||||||
return PoAction.Ok(new { data, total.Value });
|
return PoAction.Ok(new { data, total = total.Value });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return PoAction.Ok(new { data = new List<string>(), total.Value });
|
return PoAction.Ok(new { data = new List<string>(), total = total.Value });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,7 +233,7 @@ public class StoreController : ControllerBase
|
|||||||
return PoAction.Message("Npc不存在!");
|
return PoAction.Message("Npc不存在!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parms.type == 0)//装备
|
if (parms.type == 0) //装备
|
||||||
{
|
{
|
||||||
var equInfo = await _equService.GetUserEquInfo(parms.id);
|
var equInfo = await _equService.GetUserEquInfo(parms.id);
|
||||||
if (equInfo == null)
|
if (equInfo == null)
|
||||||
@@ -259,7 +263,7 @@ public class StoreController : ControllerBase
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return PoAction.Message("出售失败,请稍后尝试!");
|
return PoAction.Message("出售失败,请稍后尝试!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else //物品
|
else //物品
|
||||||
@@ -288,7 +292,7 @@ public class StoreController : ControllerBase
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return PoAction.Message("出售失败,请稍后尝试!");
|
return PoAction.Message("出售失败,请稍后尝试!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<GameBroadcast :data="broadcast"></GameBroadcast>
|
<GameBroadcast :data="broadcast"></GameBroadcast>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{{ cityInfo.cityName }}·{{ mapInfo.mapName }}
|
{{ cityInfo.cityName }}·{{ mapInfo.mapName }}({{ mapInfo.x }},{{ mapInfo.y }})
|
||||||
<Abutton @click="Refresh">刷新</Abutton>
|
<Abutton @click="Refresh">刷新</Abutton>
|
||||||
<Abar href="/task/">任务</Abar>
|
<Abar href="/task/">任务</Abar>
|
||||||
<Abar href="/user/message/">消息{{ messageCount > 0 ? "(" + messageCount + ")" : "" }}</Abar>
|
<Abar href="/user/message/">消息{{ messageCount > 0 ? "(" + messageCount + ")" : "" }}</Abar>
|
||||||
@@ -16,6 +16,11 @@
|
|||||||
<span v-for="item in mapUser">{{ item.nick }} </span>
|
<span v-for="item in mapUser">{{ item.nick }} </span>
|
||||||
</Abar>
|
</Abar>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<span class="item" v-for="item in monster">
|
||||||
|
<Abutton>{{ item.name }}</Abutton>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="item" v-for="item in npcData">
|
<div class="item" v-for="item in npcData">
|
||||||
<Abar :href='"/map/npc?npc=" + item.npcId'>{{ item.npcName }}{{ item.tips }}</Abar>
|
<Abar :href='"/map/npc?npc=" + item.npcId'>{{ item.npcName }}{{ item.tips }}</Abar>
|
||||||
@@ -116,6 +121,7 @@ const cityShow = ref<Array<any>>([]);
|
|||||||
const mapUser = ref<Array<any>>([]);
|
const mapUser = ref<Array<any>>([]);
|
||||||
const business = ref<Array<any>>([]);
|
const business = ref<Array<any>>([]);
|
||||||
const mapRes = ref<Array<any>>([]);
|
const mapRes = ref<Array<any>>([]);
|
||||||
|
const monster = ref<Array<any>>([]);
|
||||||
const messageCount = ref(0);
|
const messageCount = ref(0);
|
||||||
const broadcast = ref<Array<any>>([]);
|
const broadcast = ref<Array<any>>([]);
|
||||||
// 城内地图显示
|
// 城内地图显示
|
||||||
@@ -137,6 +143,7 @@ const BindData = async (map: string): Promise<void> => {
|
|||||||
mapInfo.value = result.data.mapInfo;
|
mapInfo.value = result.data.mapInfo;
|
||||||
cityInfo.value = result.data.cityInfo;
|
cityInfo.value = result.data.cityInfo;
|
||||||
npcData.value = result.data.npcData;
|
npcData.value = result.data.npcData;
|
||||||
|
monster.value = result.data.monster;
|
||||||
chatData.value = result.data.chatData;
|
chatData.value = result.data.chatData;
|
||||||
cityShow.value = result.data.cityShow;
|
cityShow.value = result.data.cityShow;
|
||||||
mapUser.value = result.data.nearUser;
|
mapUser.value = result.data.nearUser;
|
||||||
@@ -146,6 +153,7 @@ const BindData = async (map: string): Promise<void> => {
|
|||||||
broadcast.value = result.data.broadcast;
|
broadcast.value = result.data.broadcast;
|
||||||
MapVent(result.data.mapInfo.near);
|
MapVent(result.data.mapInfo.near);
|
||||||
onMap.value = mapInfo.value.mapId;
|
onMap.value = mapInfo.value.mapId;
|
||||||
|
console.log(result)
|
||||||
}
|
}
|
||||||
else if (result.code == 103) {
|
else if (result.code == 103) {
|
||||||
PageExtend.Redirect("/map/runing");
|
PageExtend.Redirect("/map/runing");
|
||||||
|
|||||||
67
Web/src/pages/user/bag/drug.vue
Normal file
67
Web/src/pages/user/bag/drug.vue
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<template>
|
||||||
|
<div class="module-title">
|
||||||
|
我的药品栏
|
||||||
|
</div>
|
||||||
|
<div class="module-content">
|
||||||
|
<div class="item" v-for="(item, index) in data" :key="index">
|
||||||
|
{{ index + 1 }}. <Abar :href='"/prop/goods?id=" + item.goodsId'>{{ item.name }}</Abar>({{ item.count }})
|
||||||
|
[<Abutton @click="RemoveDrug(item.id)">移除</Abutton> ]
|
||||||
|
</div>
|
||||||
|
<span v-if="data.length == 0">
|
||||||
|
暂无药品.
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="clear"></div>
|
||||||
|
<div class="module-content" style="font-size: 15px;">
|
||||||
|
说明:<br>
|
||||||
|
1.药品栏用于备战,在战斗中可以快速使用物品。<br>
|
||||||
|
2.当开启自动使用药品时,按照药品栏的顺序来进行使用物品。<br>
|
||||||
|
3.药品栏为储存战斗临时药品的空间,取回时添加到背包。<br>
|
||||||
|
4.药品栏每个栏的空间上限个数为999个。<br>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
definePageMeta({
|
||||||
|
layout: layout.default,
|
||||||
|
middleware: middleware.loading
|
||||||
|
})
|
||||||
|
|
||||||
|
const data = ref<Array<any>>([]);
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
await BindData();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
PageLoading.Close();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const BindData = async (): Promise<void> => {
|
||||||
|
let result = await UserService.GetUserDrugColumn();
|
||||||
|
if (result.code == 0) {
|
||||||
|
data.value = result.data;
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MessageExtend.ShowDialog("药品栏", result.msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const RemoveDrug = async (id: string): Promise<void> => {
|
||||||
|
MessageExtend.ShowConfirmDialogAsyc("药品栏操作", `您确定要移除该药品吗?`, async () => {
|
||||||
|
let result = await UserService.RemoverUserDrug(id);
|
||||||
|
if (result.code == 0) {
|
||||||
|
await BindData();
|
||||||
|
MessageExtend.Notify("移除成功", "success");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MessageExtend.Notify(result.msg, "danger");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user