Compare commits
18 Commits
b1a196adb1
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
723a6861a0 | ||
|
|
e4d39f3f2f | ||
| c80841880c | |||
|
|
7c7ac2991a | ||
|
|
00c2758df2 | ||
|
|
2cd2ed02f8 | ||
| c94b3ce200 | |||
|
|
4ef892e15e | ||
|
|
c9c870004b | ||
| 77fcf4ea47 | |||
|
|
73850ff7a2 | ||
|
|
171388d7e8 | ||
|
|
578d6f23db | ||
|
|
3324d7c742 | ||
|
|
aa6ca6ac08 | ||
|
|
b5de98a214 | ||
| 5d375e94bd | |||
| 858a7c2725 |
25
Application.Web.Admin/Application.Web.Admin.csproj
Normal file
25
Application.Web.Admin/Application.Web.Admin.csproj
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Update="applicationsettings.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Service\Application.Domain.Entity\Application.Domain.Entity.csproj" />
|
||||||
|
<ProjectReference Include="..\Service\Application.Domain\Application.Domain.csproj" />
|
||||||
|
<ProjectReference Include="..\Service\Application.Service.Pub\Application.Service.Pub.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Areas\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
89
Application.Web.Admin/Controllers/AccMoneyController.cs
Normal file
89
Application.Web.Admin/Controllers/AccMoneyController.cs
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Application.Web.Admin.Controllers;
|
||||||
|
|
||||||
|
public class AccMoneyController : Controller
|
||||||
|
{
|
||||||
|
private readonly IUnitUserAccService _accService;
|
||||||
|
private readonly IUnitUserService _userService;
|
||||||
|
private readonly IMessageService _messageService;
|
||||||
|
|
||||||
|
public AccMoneyController(IUnitUserAccService accService, IUnitUserService userService,
|
||||||
|
IMessageService messageService)
|
||||||
|
{
|
||||||
|
_accService = accService;
|
||||||
|
_userService = userService;
|
||||||
|
_messageService = messageService;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IActionResult> UpAcc(string u, long c, string t, string r, string p)
|
||||||
|
{
|
||||||
|
string url = "/AccMoney/Index";
|
||||||
|
|
||||||
|
var user = await _userService.GetUserInfoByUserNo(u);
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
TempData["msg"] = "用户不存在!";
|
||||||
|
return Redirect(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (await _accService.UpdateUserAccBath(user.userId, 1, t, c, p, r))
|
||||||
|
{
|
||||||
|
TempData["msg"] = "发放成功!";
|
||||||
|
string accName = GetCurrName(t);
|
||||||
|
string msg =$"亲爱的玩家,您的【{accName}】账户有变动,账户额度+{c},备注:[{r}];祝您驰骋四海,纵横天下!";
|
||||||
|
await _messageService.SendMaill(user.userId, "账户操作通知", msg, new List<TowerGet>());
|
||||||
|
return Redirect(url);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TempData["msg"] = "发放失败!";
|
||||||
|
return Redirect(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetCurrName(string accType)
|
||||||
|
{
|
||||||
|
string result = string.Empty;
|
||||||
|
switch (accType)
|
||||||
|
{
|
||||||
|
case "copper":
|
||||||
|
result = "铜贝";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "cowry":
|
||||||
|
result = "金贝";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "gold":
|
||||||
|
result = "金元";
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case "teach":
|
||||||
|
result = "师德";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "renown":
|
||||||
|
result = "声望";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "charm":
|
||||||
|
result = "魅力";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "enemy":
|
||||||
|
result = "罪恶值";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Application.Web.Admin/Controllers/IndexController.cs
Normal file
12
Application.Web.Admin/Controllers/IndexController.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Application.Web.Admin.Controllers;
|
||||||
|
|
||||||
|
public class IndexController : Controller
|
||||||
|
{
|
||||||
|
// GET
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
97
Application.Web.Admin/Controllers/SendMailController.cs
Normal file
97
Application.Web.Admin/Controllers/SendMailController.cs
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Application.Web.Admin.Controllers;
|
||||||
|
|
||||||
|
public class SendMailController : Controller
|
||||||
|
{
|
||||||
|
private readonly IMessageService _messageService;
|
||||||
|
private readonly IGameGoodsService _goodsService;
|
||||||
|
private readonly IUnitUserService _userService;
|
||||||
|
public SendMailController(IMessageService messageService,IGameGoodsService goodsService,IUnitUserService userService)
|
||||||
|
{
|
||||||
|
_messageService = messageService;
|
||||||
|
_goodsService = goodsService;
|
||||||
|
_userService = userService;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IActionResult> Send(string id, string name, string sign, string awData, int goods, int count, string remark, int type)
|
||||||
|
{
|
||||||
|
string url = "/SendMail/Index";
|
||||||
|
List<TowerGet> award = new List<TowerGet>();
|
||||||
|
if (string.IsNullOrEmpty(awData))
|
||||||
|
{
|
||||||
|
if (goods != 0)
|
||||||
|
{
|
||||||
|
var goodsInfo = await _goodsService.GetGoodsInfo(goods);
|
||||||
|
if (goodsInfo == null)
|
||||||
|
{
|
||||||
|
TempData["msg"] = "物品不存在!";
|
||||||
|
return Redirect(url);
|
||||||
|
}
|
||||||
|
TowerGet add = new TowerGet();
|
||||||
|
add.code = GameEnum.PropCode.Goods.ToString();
|
||||||
|
add.name = goodsInfo.goodsName;
|
||||||
|
add.parameter = goods.ToString();
|
||||||
|
add.count = count;
|
||||||
|
award.Add(add);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
award = JsonConvert.DeserializeObject<List<TowerGet>>(awData);
|
||||||
|
}
|
||||||
|
int index = 0;
|
||||||
|
List<string> users = new List<string>();
|
||||||
|
if (type == 0)
|
||||||
|
{
|
||||||
|
string[] ids = id.Split(',');
|
||||||
|
foreach (string item in ids)
|
||||||
|
{
|
||||||
|
var userInfo = await _userService.GetUserInfoByUserNo(item.Trim());
|
||||||
|
if (userInfo == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
users.Add(userInfo.userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == 1)
|
||||||
|
{
|
||||||
|
DateTime time = TimeAssist.GetDateTimeYMD(0);
|
||||||
|
var data = await _userService.GetOnlineUserByTime(TimeExtend.GetTimeStampBySeconds(time));
|
||||||
|
foreach (var item in data)
|
||||||
|
{
|
||||||
|
users.Add(item.userId);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var data = await _userService.GetOnlineUserByTime(0);
|
||||||
|
foreach (var item in data)
|
||||||
|
{
|
||||||
|
users.Add(item.userId);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (await _messageService.SendMaill(users, name, sign, award))
|
||||||
|
{
|
||||||
|
TempData["msg"] = string.Format("发放成功,共完成{0}个!", index);
|
||||||
|
return Redirect(url);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TempData["msg"] = "发放失败!";
|
||||||
|
return Redirect(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
Application.Web.Admin/GlobalUsing.cs
Normal file
13
Application.Web.Admin/GlobalUsing.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
global using Photon.Core;
|
||||||
|
global using Photon.Core.Jwt;
|
||||||
|
global using Photon.Core.Services;
|
||||||
|
global using Photon.Core.SqlSugar;
|
||||||
|
global using Photon.Core.Assist;
|
||||||
|
global using Photon.Core.Timer;
|
||||||
|
global using SqlSugar;
|
||||||
|
|
||||||
|
global using Application.Service.Pub;
|
||||||
|
global using Application.Domain;
|
||||||
|
global using Application.Domain.Entity;
|
||||||
|
global using Microsoft.AspNetCore.Authorization;
|
||||||
|
global using Microsoft.AspNetCore.Mvc;
|
||||||
65
Application.Web.Admin/Program.cs
Normal file
65
Application.Web.Admin/Program.cs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
using Photon.Core.Redis;
|
||||||
|
|
||||||
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
builder.Services.Inject(new List<string> {
|
||||||
|
"Application.Web.Admin","Application.Domain"
|
||||||
|
});//框架初始化
|
||||||
|
|
||||||
|
builder.Configuration.RegisterConfig();//注入配置
|
||||||
|
builder.Services.InjectRedis(builder.Configuration);
|
||||||
|
builder.Services.InjectSql(builder.Configuration);
|
||||||
|
|
||||||
|
//日志
|
||||||
|
builder.Logging.InjectLog();
|
||||||
|
// Add services to the container.
|
||||||
|
|
||||||
|
|
||||||
|
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||||
|
|
||||||
|
#region 配置跨域处理,允许所有来源
|
||||||
|
|
||||||
|
builder.Services.AddCors(options =>
|
||||||
|
{
|
||||||
|
options.AddPolicy("all", builder =>
|
||||||
|
{
|
||||||
|
builder.AllowAnyOrigin() //允许任何来源的主机访问
|
||||||
|
.AllowAnyMethod()
|
||||||
|
.AllowAnyHeader();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
#endregion 配置跨域处理,允许所有来源
|
||||||
|
|
||||||
|
|
||||||
|
builder.Services.AddSignalR();
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
app.Services.UseInject();//启用框架
|
||||||
|
app.Configuration.UseConfig();//启用配置
|
||||||
|
|
||||||
|
// Configure the HTTP request pipeline.
|
||||||
|
if (app.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseExceptionHandler("/Home/Error");
|
||||||
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||||
|
app.UseHsts();
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseCors("all");
|
||||||
|
app.UseStaticFiles();
|
||||||
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
app.UseAuthentication();
|
||||||
|
app.UseAuthorization();
|
||||||
|
|
||||||
|
app.MapControllers();
|
||||||
|
app.MapControllerRoute(
|
||||||
|
name: "default",
|
||||||
|
pattern: "{controller=Index}/{action=Index}/{id?}")
|
||||||
|
.WithStaticAssets();
|
||||||
|
|
||||||
|
SnowflakeAssist.Initialize(0, 0);
|
||||||
|
app.Run();
|
||||||
23
Application.Web.Admin/Properties/launchSettings.json
Normal file
23
Application.Web.Admin/Properties/launchSettings.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||||
|
"profiles": {
|
||||||
|
"http": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"applicationUrl": "http://localhost:5270",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"https": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"applicationUrl": "https://localhost:7023;http://localhost:5270",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
24
Application.Web.Admin/Views/AccMoney/Index.cshtml
Normal file
24
Application.Web.Admin/Views/AccMoney/Index.cshtml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<form method="post" action="/AccMoney/UpAcc">
|
||||||
|
ID:<input type="text" value="" name="u" /><br />
|
||||||
|
充值账户:
|
||||||
|
<select name="t">
|
||||||
|
<option value="copper">铜贝</option>
|
||||||
|
<option value="gold">金元</option>
|
||||||
|
<option value="cowry">金贝</option>
|
||||||
|
<option value="teach">师德</option>
|
||||||
|
<option value="renown">声望</option>
|
||||||
|
<option value="charm">魅力</option>
|
||||||
|
<option value="enemy">罪恶值</option>
|
||||||
|
</select><br />
|
||||||
|
金额:<input type="number" value="" name="c" /><br />
|
||||||
|
充值类型:
|
||||||
|
<select name="p">
|
||||||
|
<option value="其他">其他</option>
|
||||||
|
<option value="充值">充值</option>
|
||||||
|
</select><br />
|
||||||
|
备注:<input type="text" value="" name="r" /><br />
|
||||||
|
<input type="submit" value="发放" />
|
||||||
|
<div style="color:red">
|
||||||
|
* @TempData["msg"]
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
7
Application.Web.Admin/Views/Index/Index.cshtml
Normal file
7
Application.Web.Admin/Views/Index/Index.cshtml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
<div>
|
||||||
|
1.<a href="/SendMail/Index">邮件发放</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
2.<a href="/AccMoney/Index">账户充值</a>
|
||||||
|
</div>
|
||||||
26
Application.Web.Admin/Views/SendMail/Index.cshtml
Normal file
26
Application.Web.Admin/Views/SendMail/Index.cshtml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<div>
|
||||||
|
<form action="/SendMail/Send" method="post">
|
||||||
|
发送类型:<select name="type">
|
||||||
|
<option value="0">指定玩家</option>
|
||||||
|
<option value="1">当天在线</option>
|
||||||
|
<option value="2">全部玩家</option>
|
||||||
|
</select><br />
|
||||||
|
ID:<textarea name="id" cols="10" style="width:300px" rows="5"></textarea><br />
|
||||||
|
邮件主题:<input name="name" type="text" /> <br />
|
||||||
|
邮件内容:<textarea name="sign" cols="10" style="width:300px" rows="5"></textarea><br />
|
||||||
|
=======附件=====<br />
|
||||||
|
多附件字符:<textarea name="awData" cols="10" style="width:300px" rows="5"></textarea><br />
|
||||||
|
<br />
|
||||||
|
*当只有一个附件时,可以填写以下内容。
|
||||||
|
<br />
|
||||||
|
物品ID:<input name="goods" type="text" /><br />
|
||||||
|
数量:<input type="number" name="count" /><br />
|
||||||
|
说明:<input type="text" name="remark" /><br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<input type="submit" value="发送" />
|
||||||
|
</form>
|
||||||
|
<div style="color:red">
|
||||||
|
* @TempData["msg"]
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
20
Application.Web.Admin/Views/Shared/_Layout.cshtml
Normal file
20
Application.Web.Admin/Views/Shared/_Layout.cshtml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<link rel="stylesheet" type="text/css" href="/css/table.css" asp-append-version="true" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="foot" style="margin-bottom:10px">
|
||||||
|
<a href="/">返回首页</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="main">
|
||||||
|
@RenderBody()
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
3
Application.Web.Admin/Views/_ViewStart.cshtml
Normal file
3
Application.Web.Admin/Views/_ViewStart.cshtml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@{
|
||||||
|
Layout = "_Layout";
|
||||||
|
}
|
||||||
43
Application.Web.Admin/applicationsettings.json
Normal file
43
Application.Web.Admin/applicationsettings.json
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"AutoProgram": 0,
|
||||||
|
"Redis": {
|
||||||
|
"connection": "81.70.212.61:6379,password=kx.20260711,defaultdatabase=5"
|
||||||
|
},
|
||||||
|
"SqlData": [
|
||||||
|
{
|
||||||
|
"type": 0,
|
||||||
|
"name": "Kg.SeaTime.Game",
|
||||||
|
"connect": "data source=81.70.212.61;database=kg.seatime.game;user id=root;password=1f5ozxRGE3Y;pooling=true;port=3306;sslmode=Required;charset=utf8mb4;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": 0,
|
||||||
|
"name": "Kg.SeaTime.Resource",
|
||||||
|
"connect": "data source=81.70.212.61;database=kg.seatime.resource;user id=root;password=1f5ozxRGE3Y;pooling=true;port=3306;sslmode=Required;charset=utf8mb4;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": 0,
|
||||||
|
"name": "Kg.SeaTime.Log",
|
||||||
|
"connect": "data source=81.70.212.61;database=kg.seatime.log;user id=root;password=1f5ozxRGE3Y;pooling=true;port=3306;sslmode=Required;charset=utf8mb4;"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"JwtTokenOptions": {
|
||||||
|
"Issuer": "kx.seatime",
|
||||||
|
"Audience": "kx.seatime",
|
||||||
|
"SecurityKey": "46055HR0n7FeNHhDKAYD2i9ZsdsYn4jn"
|
||||||
|
},
|
||||||
|
"ResUrl": {
|
||||||
|
"local": "http://192.168.0.142:5298",
|
||||||
|
"resUrl": "http://localhost:12206",
|
||||||
|
"imgCDN": "/",
|
||||||
|
"videoCDN": "/"
|
||||||
|
},
|
||||||
|
"Sms": {
|
||||||
|
"SmsType": 1,
|
||||||
|
"AccessKey": "AKIDVptgCRP5UcT4PTGm1yf5E6pKYVBajeKn",
|
||||||
|
"Secret": "FG2atxlKflcEclgKhnc9XeU3LM6YjdGf",
|
||||||
|
"signName": "探玩驿站",
|
||||||
|
"TemplateCode": "963929",
|
||||||
|
"SmsSdkAppId": "1400523979",
|
||||||
|
"SmsOnTime": 300
|
||||||
|
}
|
||||||
|
}
|
||||||
8
Application.Web.Admin/appsettings.Development.json
Normal file
8
Application.Web.Admin/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
Application.Web.Admin/appsettings.json
Normal file
9
Application.Web.Admin/appsettings.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
||||||
25
Application.Web.Admin/wwwroot/css/table.css
Normal file
25
Application.Web.Admin/wwwroot/css/table.css
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin: 0 auto;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table td, table th {
|
||||||
|
border: 1px solid #cad9ea;
|
||||||
|
color: #666;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table thead th {
|
||||||
|
background-color: #CCE8EB;
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table tr:nth-child(odd) {
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
table tr:nth-child(even) {
|
||||||
|
background: #F5FAFA;
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AActionMethodExecutor_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003F294078ecfce6fdb942ecfee089f09717de7a6fcfe5efd9fdb6f4f93c0fb4813_003FActionMethodExecutor_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AControllerActionInvoker_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F8204b8bcfef24edfabefbc1948f556841d7908_003F2b_003F62eb27e3_003FControllerActionInvoker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIRedisCache_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F55e5569a0f314a0db6a665eafad446dd6800_003F9e_003F88bbb06d_003FIRedisCache_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIRedisCache_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F55e5569a0f314a0db6a665eafad446dd6800_003F9e_003F88bbb06d_003FIRedisCache_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AISqlSugarClient_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6c0f22f0a47643a3b2a40899acd2044c2e3a00_003F5b_003F113fef0a_003FISqlSugarClient_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AISqlSugarClient_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6c0f22f0a47643a3b2a40899acd2044c2e3a00_003F5b_003F113fef0a_003FISqlSugarClient_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AITimerJobManager_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F16de42b578c24823a56e75bd74225f401c00_003Fbf_003Fb5f6dd44_003FITimerJobManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AITimerJobManager_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F16de42b578c24823a56e75bd74225f401c00_003Fbf_003Fb5f6dd44_003FITimerJobManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<Solution>
|
<Solution>
|
||||||
|
<Project Path="Application.Web.Admin/Application.Web.Admin.csproj" />
|
||||||
<Project Path="Service/Application.Domain.Entity/Application.Domain.Entity.csproj" Id="2c4b3532-d29e-4dec-bcf3-eeceb1c374fc" />
|
<Project Path="Service/Application.Domain.Entity/Application.Domain.Entity.csproj" Id="2c4b3532-d29e-4dec-bcf3-eeceb1c374fc" />
|
||||||
<Project Path="Service/Application.Domain/Application.Domain.csproj" Id="78231809-eabc-4800-9c91-479adb485405" />
|
<Project Path="Service/Application.Domain/Application.Domain.csproj" Id="78231809-eabc-4800-9c91-479adb485405" />
|
||||||
<Project Path="Service/Application.Service.Pub/Application.Service.Pub.csproj" Id="3d90f467-0fcb-4074-bc96-33b36035ee23" />
|
<Project Path="Service/Application.Service.Pub/Application.Service.Pub.csproj" Id="3d90f467-0fcb-4074-bc96-33b36035ee23" />
|
||||||
|
|||||||
34
README.md
34
README.md
@@ -4,3 +4,37 @@
|
|||||||
|
|
||||||
\# Web :前端项目,VUE
|
\# Web :前端项目,VUE
|
||||||
|
|
||||||
|
# 任务生成提示词
|
||||||
|
|
||||||
|
提示词:
|
||||||
|
|
||||||
|
|
||||||
|
现在需要你进行wap游戏的任务数据生成,生成要求按照当前目录下:requirement.md中的要求生成。
|
||||||
|
|
||||||
|
任务背景:讲诉大航海时代,新手航海家,准备出海历险,精力海啸,坏血病等航海各类事件的故事,包含和青梅竹马告别等场景;你可以细化详细的一个故事。
|
||||||
|
|
||||||
|
任务环数:200 环
|
||||||
|
|
||||||
|
任务总经验:160000000
|
||||||
|
|
||||||
|
任务总声望:200
|
||||||
|
|
||||||
|
任务总铜贝:10000000
|
||||||
|
|
||||||
|
怪物最大等级:30-70级
|
||||||
|
|
||||||
|
其他要求:
|
||||||
|
|
||||||
|
任务ID的起始ID为:1002001
|
||||||
|
|
||||||
|
NPCID的起始ID为:2001021
|
||||||
|
|
||||||
|
物品ID的起始ID为:70025
|
||||||
|
|
||||||
|
售卖ID的起始ID为:200005
|
||||||
|
|
||||||
|
怪物的起始ID为:300035
|
||||||
|
|
||||||
|
采集配置的起始ID为:20001
|
||||||
|
|
||||||
|
按照要求先进行生成数据结构分析,然后根据提示完成整个故事情节的设计,我确认无误后开始生成任务相关数据。
|
||||||
@@ -10,4 +10,8 @@
|
|||||||
<ProjectReference Include="..\Application.Service.Pub\Application.Service.Pub.csproj" />
|
<ProjectReference Include="..\Application.Service.Pub\Application.Service.Pub.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="log\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
39
Service/Application.Domain.Entity/game/game/game_magic.cs
Normal file
39
Service/Application.Domain.Entity/game/game/game_magic.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Application.Domain.Entity
|
||||||
|
{
|
||||||
|
[Tenant("Kg.SeaTime.Game")]
|
||||||
|
public class game_magic
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// userId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true, Length = 50)]
|
||||||
|
public string userId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// areaId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? areaId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// time
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// isWin
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? isWin { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// uptime
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public long? uptime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,12 @@ namespace Application.Domain.Entity
|
|||||||
[SugarColumn(IsPrimaryKey = true, Length = 50)]
|
[SugarColumn(IsPrimaryKey = true, Length = 50)]
|
||||||
public string tradeId { get; set; }
|
public string tradeId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// areaId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? areaId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// userId
|
/// userId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Application.Domain.Entity
|
||||||
|
{
|
||||||
|
[Tenant("Kg.SeaTime.Game")]
|
||||||
|
public class unit_user_escort
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// userId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true, Length = 50)]
|
||||||
|
public string userId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// esId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? esId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// name
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IsUse
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? isUse { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// state
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? state { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// endTime
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public long? endTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,8 +39,8 @@ namespace Application.Domain.Entity
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// attr
|
/// attr
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(Length = 1000, IsNullable = true)]
|
[SugarColumn(IsNullable = true, IsJson = true)]
|
||||||
public string attr { get; set; }
|
public List<AttrItem> attr { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// count
|
/// count
|
||||||
@@ -66,4 +66,4 @@ namespace Application.Domain.Entity
|
|||||||
[SugarColumn(IsNullable = true)]
|
[SugarColumn(IsNullable = true)]
|
||||||
public int? show { get; set; }
|
public int? show { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,12 +18,6 @@ namespace Application.Domain.Entity
|
|||||||
[SugarColumn(IsNullable = true)]
|
[SugarColumn(IsNullable = true)]
|
||||||
public long? vitality { get; set; }
|
public long? vitality { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 最大活力
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(IsNullable = true)]
|
|
||||||
public long? upVitality { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新时间
|
/// 更新时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -62,12 +62,14 @@ namespace Application.Domain.Entity
|
|||||||
|
|
||||||
[SugarColumn(Length = 50, IsNullable = true)]
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
public string? winCode { get; set; }
|
public string? winCode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 胜利方
|
/// 胜利方
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(Length = 50, IsNullable = true)]
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
public string? winUser { get; set; }
|
public string? winUser { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 经验
|
/// 经验
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -91,9 +93,16 @@ namespace Application.Domain.Entity
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(IsNullable = true)]
|
[SugarColumn(IsNullable = true)]
|
||||||
public string? award { get; set; }
|
public string? award { get; set; }
|
||||||
|
|
||||||
[SugarColumn(IsNullable = true)]
|
[SugarColumn(IsNullable = true)]
|
||||||
public string? pars { get; set; }
|
public string? pars { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 预计用时
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public long? dueTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// addTime
|
/// addTime
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -112,4 +121,4 @@ namespace Application.Domain.Entity
|
|||||||
[SugarColumn(IsNullable = true)]
|
[SugarColumn(IsNullable = true)]
|
||||||
public long? endTime { get; set; }
|
public long? endTime { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,4 +5,5 @@ public class NpcBus
|
|||||||
public string code { get; set; }
|
public string code { get; set; }
|
||||||
public string name { get; set; }
|
public string name { get; set; }
|
||||||
public string url { get; set; }
|
public string url { get; set; }
|
||||||
|
public string parms { get; set; }
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Application.Domain.Entity;
|
||||||
|
|
||||||
|
public class RankAwardModel
|
||||||
|
{
|
||||||
|
public int min { get; set; }
|
||||||
|
public int max { get; set; }
|
||||||
|
public List<TowerGet> award { get; set; }
|
||||||
|
}
|
||||||
51
Service/Application.Domain.Entity/resource/game/game_cdk.cs
Normal file
51
Service/Application.Domain.Entity/resource/game/game_cdk.cs
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Application.Domain.Entity
|
||||||
|
{
|
||||||
|
[Tenant("Kg.SeaTime.Resource")]
|
||||||
|
public class game_cdk
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// cdkId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true)]
|
||||||
|
public int cdkId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// area
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? area { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// cdkName
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 255, IsNullable = true)]
|
||||||
|
public string? cdkName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// award
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true,IsJson = true)]
|
||||||
|
public List<TowerGet> award { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// limit
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? limit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// addTime
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public DateTime? addTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// endTime
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public DateTime? endTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Application.Domain.Entity
|
||||||
|
{
|
||||||
|
[Tenant("Kg.SeaTime.Resource")]
|
||||||
|
public class game_cdk_item
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ciId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true, Length = 50)]
|
||||||
|
public string ciId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// cdkId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? cdkId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// userId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? userId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// upTime
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public DateTime? upTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Application.Domain.Entity
|
||||||
|
{
|
||||||
|
[Tenant("Kg.SeaTime.Resource")]
|
||||||
|
public class game_escort
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// esId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true)]
|
||||||
|
public int esId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// random
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? random { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// name
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 255, IsNullable = true)]
|
||||||
|
public string? name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// award
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public string? award { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,8 +27,8 @@ namespace Application.Domain.Entity
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// attr
|
/// attr
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(Length = 1000, IsNullable = true)]
|
[SugarColumn(IsNullable = true, IsJson = true)]
|
||||||
public string attr { get; set; }
|
public List<AttrItem> attr { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// remark
|
/// remark
|
||||||
@@ -36,4 +36,4 @@ namespace Application.Domain.Entity
|
|||||||
[SugarColumn(IsNullable = true)]
|
[SugarColumn(IsNullable = true)]
|
||||||
public string remark { get; set; }
|
public string remark { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,9 @@ namespace Application.Domain
|
|||||||
HandleExchangeData,//处理兑换数据
|
HandleExchangeData,//处理兑换数据
|
||||||
HandleTaskLog,//处理任务日志
|
HandleTaskLog,//处理任务日志
|
||||||
HandelTaskUser,//处理角色任务
|
HandelTaskUser,//处理角色任务
|
||||||
|
HandleClearChat,//清理频道信息
|
||||||
|
HandleMessageData,//处理消息类
|
||||||
|
HandleMagicData,//处理魔城争霸赛
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,5 +105,28 @@
|
|||||||
var taskService = App.GetService<IGameTaskService>();
|
var taskService = App.GetService<IGameTaskService>();
|
||||||
await taskService.HandleUserTask();
|
await taskService.HandleUserTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理频道信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context"></param>
|
||||||
|
[EventSubscribe(BusEventsEnum.BusEventsName.HandleClearChat, NumRetries = 0,RetryTimeout = 999999999)]
|
||||||
|
public async Task HandleClearChat(EventHandlerExecutingContext context)
|
||||||
|
{
|
||||||
|
var chatService = App.GetService<IGameChatService>();
|
||||||
|
await chatService.ClearChat();
|
||||||
|
}
|
||||||
|
[EventSubscribe(BusEventsEnum.BusEventsName.HandleMessageData, NumRetries = 0,RetryTimeout = 999999999)]
|
||||||
|
public async Task HandleMessageData(EventHandlerExecutingContext context)
|
||||||
|
{
|
||||||
|
var messageService = App.GetService<IMessageService>();
|
||||||
|
await messageService.HandleMessageData();
|
||||||
|
}
|
||||||
|
[EventSubscribe(BusEventsEnum.BusEventsName.HandleMagicData, NumRetries = 0,RetryTimeout = 999999999)]
|
||||||
|
public async Task HandleMagicData(EventHandlerExecutingContext context)
|
||||||
|
{
|
||||||
|
var magicService = App.GetService<IGameMagicService>();
|
||||||
|
await magicService.HandleMagicData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,7 @@ public static class GameConfig
|
|||||||
public const int SendChatGoodsService = 10002;//金海螺
|
public const int SendChatGoodsService = 10002;//金海螺
|
||||||
public const int UpLevAddWeight = 10;//升级增加负重
|
public const int UpLevAddWeight = 10;//升级增加负重
|
||||||
public const int GameBaseVigour = 50;//初始活力
|
public const int GameBaseVigour = 50;//初始活力
|
||||||
public const int GameRelationEnemyNeedGold = 300;//添加仇人所需金元
|
public const int GameRelationEnemyNeedGold = 100;//添加仇人所需金元
|
||||||
public const int GameUpdateNickNeedGoods = 10018;//更新昵称所需道具
|
public const int GameUpdateNickNeedGoods = 10018;//更新昵称所需道具
|
||||||
public const int GameUpdateSexNeedGoods = 10065;//更新性别所需道具
|
public const int GameUpdateSexNeedGoods = 10065;//更新性别所需道具
|
||||||
public const int GameUserFriendMaxCount = 50;//好友最大上限人数
|
public const int GameUserFriendMaxCount = 50;//好友最大上限人数
|
||||||
@@ -20,4 +20,6 @@ public static class GameConfig
|
|||||||
public const int GameEquApprGoods = 10019;//鉴定装备道具
|
public const int GameEquApprGoods = 10019;//鉴定装备道具
|
||||||
public const int GameGetTaskGoods =10034 ;//引路蜂
|
public const int GameGetTaskGoods =10034 ;//引路蜂
|
||||||
public const int GameRetTaskGoods =10033 ;//领路蝶
|
public const int GameRetTaskGoods =10033 ;//领路蝶
|
||||||
|
public const string GameMagicMapId = "257_18";//魔城地图ID
|
||||||
|
public const string GameMagicInMapId = "260_15";//魔城进入地图ID
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ public static class GameEnum
|
|||||||
single,//1次
|
single,//1次
|
||||||
alway,//永久
|
alway,//永久
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum JobCode
|
public enum JobCode
|
||||||
{
|
{
|
||||||
OnHook,//定时任务
|
OnHook,//定时任务
|
||||||
@@ -17,6 +18,9 @@ public static class GameEnum
|
|||||||
UpdateExchangeData,//更新兑换的记录
|
UpdateExchangeData,//更新兑换的记录
|
||||||
UpdateTaskLog,//更新任务日志
|
UpdateTaskLog,//更新任务日志
|
||||||
UpdateTaskUser,//更新角色任务
|
UpdateTaskUser,//更新角色任务
|
||||||
|
ClearChat,//清理频道信息
|
||||||
|
ClearMessage,//清理个人消息信息
|
||||||
|
UpdateMagicData,//处理魔城数据
|
||||||
}
|
}
|
||||||
public enum PropCode//游戏资源编码
|
public enum PropCode//游戏资源编码
|
||||||
{
|
{
|
||||||
@@ -82,6 +86,8 @@ public static class GameEnum
|
|||||||
{
|
{
|
||||||
Awaken,//觉醒配置
|
Awaken,//觉醒配置
|
||||||
Quality,//洗练配置
|
Quality,//洗练配置
|
||||||
|
MagicAward,//魔城奖励
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum ComputeType
|
public enum ComputeType
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public static class GoodsEnum
|
|||||||
Practise,//修炼道具
|
Practise,//修炼道具
|
||||||
Durability,//耐久道具
|
Durability,//耐久道具
|
||||||
AddExp,//扣除经验获得道具
|
AddExp,//扣除经验获得道具
|
||||||
|
Collect,//收集的物品
|
||||||
GetExp//使用后获得经验
|
GetExp//使用后获得经验
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,14 +14,18 @@ public class MapEnum
|
|||||||
public enum MapCode
|
public enum MapCode
|
||||||
{
|
{
|
||||||
DEF_MAP,
|
DEF_MAP,
|
||||||
Dup_Map
|
Dup_Map,
|
||||||
|
Magic_Map,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum NpcCode
|
public enum NpcCode
|
||||||
{
|
{
|
||||||
Default,
|
Default,
|
||||||
Task,
|
Task,
|
||||||
Dup_In,
|
Event,
|
||||||
Dup_Exit
|
}
|
||||||
|
public enum NpcEventCode
|
||||||
|
{
|
||||||
|
Magic_Event,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,5 @@ public static class SkillEnum
|
|||||||
AGILE,//敏捷术
|
AGILE,//敏捷术
|
||||||
RIDI,//乘骑术
|
RIDI,//乘骑术
|
||||||
WING,//翼形术
|
WING,//翼形术
|
||||||
Collect,//采集术
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
|
public interface IGameCdkService
|
||||||
|
{
|
||||||
|
Task<game_cdk> GetCdkInfo(int cdkId);
|
||||||
|
|
||||||
|
Task<game_cdk_item> GetCdkItemInfo(string cdk);
|
||||||
|
|
||||||
|
Task<bool> UpdateCdkUser(string cdk, string userId);
|
||||||
|
|
||||||
|
Task<int> GetUserCdkCount(int cdkId, string userId);
|
||||||
|
|
||||||
|
Task<bool> AddCdkItem(List<game_cdk_item> data);
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
|
public interface IGameEscortService
|
||||||
|
{
|
||||||
|
Task<List<game_escort>> GetEscortData();
|
||||||
|
Task<game_escort> GetEscortInfo(int esId);
|
||||||
|
Task<unit_user_escort> GetUserEscort(string userId);
|
||||||
|
Task<bool> ClearUserEscort(string userId);
|
||||||
|
Task<bool> UpdateUserEscort(string userId, int esId, string name);
|
||||||
|
Task<bool> UpdateUserEscort(unit_user_escort data);
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
|
public interface IGameMagicService
|
||||||
|
{
|
||||||
|
Task UpdateUserMagicTime(string userId,int areaId);
|
||||||
|
Task UpdateUserMagicEndTime(string userId, bool isWin);
|
||||||
|
Task<bool> IsHaveWin(int areaId, string time);
|
||||||
|
Task<bool> CheckInMagic(string userId);
|
||||||
|
Task HandleMagicData();
|
||||||
|
}
|
||||||
@@ -12,4 +12,5 @@ public interface IGameChatService
|
|||||||
Task<bool> SendChat(string userId, string code, string sign, string par = "");
|
Task<bool> SendChat(string userId, string code, string sign, string par = "");
|
||||||
Task<game_chat> GetChatInfo(string chatId);
|
Task<game_chat> GetChatInfo(string chatId);
|
||||||
Task<bool> DeleteChat(string chatId, string opUser);
|
Task<bool> DeleteChat(string chatId, string opUser);
|
||||||
|
Task ClearChat();
|
||||||
}
|
}
|
||||||
@@ -13,9 +13,9 @@ public interface IGameFightService
|
|||||||
Task RemoveFightHarm(string fightId, string userId);
|
Task RemoveFightHarm(string fightId, string userId);
|
||||||
Task<bool> AddFight(string fightId, string areaCode, string keyId, string mainId, string code,
|
Task<bool> AddFight(string fightId, string areaCode, string keyId, string mainId, string code,
|
||||||
string scene, string mapId,
|
string scene, string mapId,
|
||||||
string userId, long exp = 0, long copper = 0, long petExp = 0, string award = "", string pars = "");
|
string userId,long dueTime, long exp = 0, long copper = 0, long petExp = 0, string award = "", string pars = "");
|
||||||
|
|
||||||
Task<bool> SetFightWin(game_fight_data fightData, string winUser,bool setDefMap=true);
|
Task<bool> SetFightWin(game_fight_data fightData, string winUser, bool setDefMap=true);
|
||||||
Task HandleFightData();
|
Task HandleFightData();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -29,6 +29,7 @@ public interface IGameFightService
|
|||||||
Task RemoveFightGoods(string mapId, string mgId);
|
Task RemoveFightGoods(string mapId, string mgId);
|
||||||
Task AutoUseDrug(UserAttrModel user, game_fight_data fight);
|
Task AutoUseDrug(UserAttrModel user, game_fight_data fight);
|
||||||
Task HandelFightEnd(string userId, List<FightRemoveData> data);
|
Task HandelFightEnd(string userId, List<FightRemoveData> data);
|
||||||
|
Task<bool> ValidFight(game_fight_data fight, bool isBlack = true);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ public interface IGameMapService
|
|||||||
Task<string> GetUserOnMapId(string userId);
|
Task<string> GetUserOnMapId(string userId);
|
||||||
Task<game_city_map> GetUserOnToMapInfo(string userId);
|
Task<game_city_map> GetUserOnToMapInfo(string userId);
|
||||||
Task<unit_user_online> GetUserOnMap(string userId);
|
Task<unit_user_online> GetUserOnMap(string userId);
|
||||||
Task UpdateUserOnMap(string userId);
|
Task UpdateUserOnMap(string userId, string mapId = "");
|
||||||
Task UpdateUserOnMap(string userId, string ip, string mapId);
|
Task UpdateUserOnMap(string userId, string ip, string mapId);
|
||||||
Task<bool> UpdateUserOnMap(unit_user_online data, string mapId);
|
Task<bool> UpdateUserOnMap(unit_user_online data, string mapId);
|
||||||
Task<UserOnMap> GetUserOnMapInfo(string userId);
|
Task<UserOnMap> GetUserOnMapInfo(string userId);
|
||||||
@@ -34,6 +34,8 @@ public interface IGameMapService
|
|||||||
|
|
||||||
#region 其他相关
|
#region 其他相关
|
||||||
|
|
||||||
|
Task<List<UserModel>> GetMapUserByAll(string mapId, int area, int showArea, List<string> noUser);
|
||||||
|
Task<List<UserModel>> GetMapUser(string mapId, int area, int showArea, List<string> noUser);
|
||||||
Task<List<UserModel>> GetMapUser(string mapId, int area, int showArea, List<string> noUser, int take);
|
Task<List<UserModel>> GetMapUser(string mapId, int area, int showArea, List<string> noUser, int take);
|
||||||
|
|
||||||
Task<List<UserModel>> GetMapUser(string mapId, int area, int showArea, List<string> noUser, int page,
|
Task<List<UserModel>> GetMapUser(string mapId, int area, int showArea, List<string> noUser, int page,
|
||||||
|
|||||||
@@ -3,4 +3,5 @@
|
|||||||
public interface IGameDicService
|
public interface IGameDicService
|
||||||
{
|
{
|
||||||
Task<game_dic> GetDicInfo(string code);
|
Task<game_dic> GetDicInfo(string code);
|
||||||
|
Task<string> GetDicInfoContent(string code);
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,19 @@
|
|||||||
|
|
||||||
public interface IGameMaxNameService
|
public interface IGameMaxNameService
|
||||||
{
|
{
|
||||||
|
#region 资源
|
||||||
|
|
||||||
|
Task<game_maxname> GetMaxNameInfo(string mnId);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region unit_user_maxname
|
#region unit_user_maxname
|
||||||
|
|
||||||
|
Task<bool> AddMaxName(string userId, string mnId, int addCount);
|
||||||
Task<bool> UpdateUserMaxname(unit_user_maxname name);
|
Task<bool> UpdateUserMaxname(unit_user_maxname name);
|
||||||
Task<unit_user_maxname> GetUserMaxnameInfo(string umnId);
|
Task<unit_user_maxname> GetUserMaxnameInfo(string umnId);
|
||||||
Task<List<unit_user_maxname>> GetUserMaxnameList(string userId, int page, int limit, RefAsync<int> total);
|
Task<List<unit_user_maxname>> GetUserMaxnameList(string userId, int page, int limit, RefAsync<int> total);
|
||||||
|
Task<List<unit_user_maxname>> GetUserMaxNameData(string userId);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,9 @@ public interface IMessageService
|
|||||||
Task<List<unit_user_mail>> GetUserMailData(string userId, int page, int limit, RefAsync<int> total);
|
Task<List<unit_user_mail>> GetUserMailData(string userId, int page, int limit, RefAsync<int> total);
|
||||||
Task<unit_user_mail> GetMailInfo(string mailId);
|
Task<unit_user_mail> GetMailInfo(string mailId);
|
||||||
Task<bool> SendMaill(string userId, string name, string sign, List<TowerGet> award, int days = 10);
|
Task<bool> SendMaill(string userId, string name, string sign, List<TowerGet> award, int days = 10);
|
||||||
|
|
||||||
|
Task<bool> SendMaill(List<string> userIds, string name, string sign, List<TowerGet> award,
|
||||||
|
int days = 10);
|
||||||
Task<bool> UpdateMaillInfo(unit_user_mail data);
|
Task<bool> UpdateMaillInfo(unit_user_mail data);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -47,7 +50,9 @@ public interface IMessageService
|
|||||||
#region 广播消息
|
#region 广播消息
|
||||||
|
|
||||||
Task<List<game_broadcast>> GetBroadcastData(int area);
|
Task<List<game_broadcast>> GetBroadcastData(int area);
|
||||||
Task<bool> SendBroadcast(string userId, string code, string msg);
|
Task<bool> SendBroadcast(string userId, string code, string msg, int area = 0);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
Task HandleMessageData();
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
public interface INoticeService
|
public interface INoticeService
|
||||||
{
|
{
|
||||||
Task<List<game_notice>> GetNoticeDataByTake(int take);
|
Task<List<game_notice>> GetNoticeDataByTake(int take);
|
||||||
|
Task<List<game_notice>> GetNoticeDataByMap();
|
||||||
Task<List<game_notice>> GetNoticeData(int page, int limit, RefAsync<int> total);
|
Task<List<game_notice>> GetNoticeData(int page, int limit, RefAsync<int> total);
|
||||||
Task<game_notice> GetNoticeInfo(string id);
|
Task<game_notice> GetNoticeInfo(string id);
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
public interface ITradeService
|
public interface ITradeService
|
||||||
{
|
{
|
||||||
Task<bool> AddTrade(string userId, string code,string name, string propId, int count, long price,string content);
|
Task<game_trade> GetTradeInfo(string tradeId);
|
||||||
|
Task<bool> AddTrade(int areaId, string userId, string code,string name, string propId, int count, long price,string content);
|
||||||
|
Task<bool> UpdateTradeCount(string tradeId, int op, int count, bool isDel = false);
|
||||||
Task<int> GetUserTradeCount(string userId);
|
Task<int> GetUserTradeCount(string userId);
|
||||||
|
Task<List<game_trade>> GetUserTradeData(string userId);
|
||||||
|
|
||||||
|
Task<List<game_trade>> GetUserTradeData(int areaId,string userId, int type, string query, int page, int limit,
|
||||||
|
RefAsync<int> total);
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ public interface IUnitUserAttrService
|
|||||||
|
|
||||||
Task<unit_user_exp> GetUserExp(string userId);
|
Task<unit_user_exp> GetUserExp(string userId);
|
||||||
Task<bool> UpdateUserExp(string userId, long exp, int op = 1);
|
Task<bool> UpdateUserExp(string userId, long exp, int op = 1);
|
||||||
|
Task DeductUserExp(string userId, int type, long count);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 士气操作
|
#region 士气操作
|
||||||
@@ -37,8 +37,7 @@ public interface IUnitUserAttrService
|
|||||||
|
|
||||||
Task<unit_user_vigour> GetUserVigourInfo(string userId);
|
Task<unit_user_vigour> GetUserVigourInfo(string userId);
|
||||||
Task<bool> UpdateUserVigour(string userId, int op, long count, string UpTime = "");
|
Task<bool> UpdateUserVigour(string userId, int op, long count, string UpTime = "");
|
||||||
Task<bool> UpdateUserUpVigour(string userId, decimal count);
|
Task<long> GetUserMaxVitality(string userId);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 在线时间
|
#region 在线时间
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public interface IUnitUserService
|
|||||||
Task<bool> UpdateUserNick(string userId, string nick);
|
Task<bool> UpdateUserNick(string userId, string nick);
|
||||||
Task<bool> UpdateUserSex(string userId, string sex);
|
Task<bool> UpdateUserSex(string userId, string sex);
|
||||||
Task<bool> UpdateUserSign(string userId, string sign);
|
Task<bool> UpdateUserSign(string userId, string sign);
|
||||||
|
Task<bool> BlackUser(string userId);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 用户注册
|
#region 用户注册
|
||||||
@@ -31,7 +32,7 @@ public interface IUnitUserService
|
|||||||
#region 其他
|
#region 其他
|
||||||
|
|
||||||
Task<int> GetOnlineCount();
|
Task<int> GetOnlineCount();
|
||||||
|
Task<List<unit_user_online>> GetOnlineUserByTime(long time);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
|
public class GameCdkService(ISqlSugarClient DbClient, IRedisCache redis) : IGameCdkService, ITransient
|
||||||
|
{
|
||||||
|
public async Task<game_cdk> GetCdkInfo(int cdkId)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_cdk>();
|
||||||
|
return await db.Queryable<game_cdk>().Where(it => it.cdkId == cdkId).SingleAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<game_cdk_item> GetCdkItemInfo(string cdk)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_cdk_item>();
|
||||||
|
return await db.Queryable<game_cdk_item>().Where(it => it.ciId == cdk).SingleAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> UpdateCdkUser(string cdk, string userId)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_cdk_item>();
|
||||||
|
return await db.Updateable<game_cdk_item>().SetColumns(it => it.userId == userId)
|
||||||
|
.SetColumns(it => it.upTime == DateTime.Now)
|
||||||
|
.Where(it => it.ciId == cdk).ExecuteCommandAsync() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<int> GetUserCdkCount(int cdkId, string userId)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_cdk_item>();
|
||||||
|
return await db.Queryable<game_cdk_item>().Where(it => it.cdkId == cdkId && it.userId == userId).CountAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> AddCdkItem(List<game_cdk_item> data)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_cdk_item>();
|
||||||
|
return await db.Insertable(data).ExecuteCommandAsync() > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
|
public class GameEscortService(ISqlSugarClient DbClient, IRedisCache redis) : IGameEscortService, ITransient
|
||||||
|
{
|
||||||
|
public async Task<List<game_escort>> GetEscortData()
|
||||||
|
{
|
||||||
|
string key = string.Format(BaseCache.BaseCacheKeys, "Escort", "Data");
|
||||||
|
if (await redis.ExistsAsync(key))
|
||||||
|
{
|
||||||
|
return await redis.GetAsync<List<game_escort>>(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_escort>();
|
||||||
|
var data = await db.Queryable<game_escort>().ToListAsync();
|
||||||
|
await redis.SetAsync(key, data);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<game_escort> GetEscortInfo(int esId)
|
||||||
|
{
|
||||||
|
string key = string.Format(BaseCache.BaseCacheKeys, "Escort", "Info");
|
||||||
|
if (await redis.HExistsHashAsync(key, esId.ToString()))
|
||||||
|
{
|
||||||
|
return await redis.GetHashAsync<game_escort>(key, esId.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_escort>();
|
||||||
|
var data = await db.Queryable<game_escort>().Where(it => it.esId == esId).SingleAsync();
|
||||||
|
await redis.AddHashAsync(key, esId.ToString(), data);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<unit_user_escort> GetUserEscort(string userId)
|
||||||
|
{
|
||||||
|
string key = string.Format(UserCache.BaseCacheKey, "UserEscort");
|
||||||
|
if (await redis.HExistsHashAsync(key, userId))
|
||||||
|
{
|
||||||
|
return await redis.GetHashAsync<unit_user_escort>(key, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_escort>();
|
||||||
|
var data = await db.Queryable<unit_user_escort>().Where(it => it.userId == userId).SingleAsync();
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
data = new unit_user_escort()
|
||||||
|
{
|
||||||
|
userId = userId,
|
||||||
|
esId = 0,
|
||||||
|
name = "",
|
||||||
|
state = 0,
|
||||||
|
endTime = TimeExtend.GetTimeStampSeconds
|
||||||
|
};
|
||||||
|
await db.Insertable(data).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
await redis.AddHashAsync(key, userId, data);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> ClearUserEscort(string userId)
|
||||||
|
{
|
||||||
|
unit_user_escort data = new unit_user_escort()
|
||||||
|
{
|
||||||
|
userId = userId,
|
||||||
|
esId = 0,
|
||||||
|
name = "",
|
||||||
|
isUse = 0,
|
||||||
|
state = 0,
|
||||||
|
endTime = TimeExtend.GetTimeStampSeconds
|
||||||
|
};
|
||||||
|
return await UpdateUserEscort(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> UpdateUserEscort(string userId, int esId, string name)
|
||||||
|
{
|
||||||
|
long time = TimeExtend.GetTimeStampSeconds + 300;
|
||||||
|
unit_user_escort data = data = new unit_user_escort()
|
||||||
|
{
|
||||||
|
userId = userId,
|
||||||
|
esId = esId,
|
||||||
|
name = name,
|
||||||
|
state = 1,
|
||||||
|
isUse = 0,
|
||||||
|
endTime = time
|
||||||
|
};
|
||||||
|
return await UpdateUserEscort(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> UpdateUserEscort(unit_user_escort data)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_escort>();
|
||||||
|
var result = await db.Insertable(data).ExecuteCommandAsync() > 0;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
string key = string.Format(UserCache.BaseCacheKey, "UserEscort");
|
||||||
|
await redis.DelHashAsync(key, data.userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,146 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
|
public class GameMagicService(ISqlSugarClient DbClient, IRedisCache redis) : IGameMagicService, ITransient
|
||||||
|
{
|
||||||
|
public async Task UpdateUserMagicTime(string userId, int areaId)
|
||||||
|
{
|
||||||
|
string time = TimeAssist.GetDateTimeYMDString(0);
|
||||||
|
long upTime = TimeExtend.GetTimeStampMilliseconds;
|
||||||
|
game_magic data = new game_magic()
|
||||||
|
{
|
||||||
|
userId = userId,
|
||||||
|
areaId = areaId,
|
||||||
|
time = time,
|
||||||
|
isWin = 0,
|
||||||
|
uptime = upTime
|
||||||
|
};
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_magic>();
|
||||||
|
await db.Storageable(data).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task UpdateUserMagicEndTime(string userId, bool isWin)
|
||||||
|
{
|
||||||
|
long upTime = TimeExtend.GetTimeStampMilliseconds;
|
||||||
|
if (isWin)
|
||||||
|
{
|
||||||
|
upTime = TimeExtend.GetTimeStampByMilliseconds(TimeAssist.GetDateTimeYMD(7));
|
||||||
|
}
|
||||||
|
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_magic>();
|
||||||
|
await db.Updateable<game_magic>().SetColumns(it => it.uptime == upTime)
|
||||||
|
.SetColumns(it => it.isWin == (isWin ? 1 : 0))
|
||||||
|
.Where(it => it.userId == userId)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> IsHaveWin(int areaId, string time)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_magic>();
|
||||||
|
return await db.Queryable<game_magic>().Where(it => it.areaId == areaId && it.time == time && it.isWin == 1)
|
||||||
|
.AnyAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> CheckInMagic(string userId)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_magic>();
|
||||||
|
var myInfo = await db.Queryable<game_magic>().Where(it => it.userId == userId).SingleAsync();
|
||||||
|
if (myInfo == null)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (myInfo.isWin == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
long time = TimeExtend.GetTimeStampMilliseconds;
|
||||||
|
if (myInfo.uptime < time)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task HandleMagicData()
|
||||||
|
{
|
||||||
|
List<RankAwardModel> magicAward = new List<RankAwardModel>();
|
||||||
|
var mapService = App.GetService<IGameMapService>();
|
||||||
|
var userService = App.GetService<IUnitUserService>();
|
||||||
|
var areaService = App.GetService<IAreaService>();
|
||||||
|
var dicService = App.GetService<IGameDicService>();
|
||||||
|
var messageService = App.GetService<IMessageService>();
|
||||||
|
|
||||||
|
|
||||||
|
string time = TimeAssist.GetDateTimeYMDString(0);
|
||||||
|
|
||||||
|
var dicData = await dicService.GetDicInfoContent(nameof(GameEnum.DicCode.MagicAward));
|
||||||
|
if (!string.IsNullOrEmpty(dicData))
|
||||||
|
{
|
||||||
|
magicAward = JsonConvert.DeserializeObject<List<RankAwardModel>>(dicData);
|
||||||
|
}
|
||||||
|
|
||||||
|
var areaData = await areaService.GetAreaData();
|
||||||
|
foreach (var area in areaData)
|
||||||
|
{
|
||||||
|
//清退处理
|
||||||
|
var users = await mapService.GetMapUserByAll(GameConfig.GameMagicMapId, area.areaId, 1, []);
|
||||||
|
if (users.Count > 0)
|
||||||
|
{
|
||||||
|
bool isHaveWin = await IsHaveWin(area.areaId, time);
|
||||||
|
for (int i = 1; i <= users.Count; i++)
|
||||||
|
{
|
||||||
|
string userId = users[i - 1].userId;
|
||||||
|
bool isWin = false;
|
||||||
|
if (i == users.Count && isHaveWin == false)
|
||||||
|
{
|
||||||
|
isWin = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
await UpdateUserMagicEndTime(userId, isWin);
|
||||||
|
await mapService.UpdateUserOnMap(userId, GameConfig.GameMagicInMapId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//发放奖励
|
||||||
|
if (magicAward.Count > 0)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_magic>();
|
||||||
|
var userData = await db.Queryable<game_magic>().Where(it => it.areaId == area.areaId && it.time == time)
|
||||||
|
.OrderByDescending(it => it
|
||||||
|
.isWin).OrderByDescending(it => it.uptime).ToListAsync();
|
||||||
|
if (userData.Any(it => it.isWin == 1))
|
||||||
|
{
|
||||||
|
string msg = "魔城争霸赛已结束,前三名分别是:";
|
||||||
|
int rank = 1;
|
||||||
|
foreach (var user in userData)
|
||||||
|
{
|
||||||
|
var onAward = magicAward.Find(it => it.min <= rank && it.max >= rank);
|
||||||
|
if (onAward != null)
|
||||||
|
{
|
||||||
|
string mailContent = $"恭喜您获得魔城争霸赛第【{rank}】名奖励,再接再厉噢!";
|
||||||
|
await messageService.SendMaill(user.userId, "魔城争霸赛奖励发放通知", mailContent, onAward.award);
|
||||||
|
if (rank <= 3)
|
||||||
|
{
|
||||||
|
var userInfo = await userService.GetUserInfoByUserId(user.userId);
|
||||||
|
msg += $"{UbbTool.HomeUbb(userInfo.userNo, userInfo.nick)}、";
|
||||||
|
}
|
||||||
|
|
||||||
|
rank++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = msg.TrimEnd('、');
|
||||||
|
await messageService.SendBroadcast("0", nameof(MessageEnum.BroadcastCode.System), msg, area.areaId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,7 +40,7 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer
|
|||||||
.OrderByIF(type == 7, it => it.score, OrderByType.Desc)
|
.OrderByIF(type == 7, it => it.score, OrderByType.Desc)
|
||||||
.Take(100)
|
.Take(100)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
total = data.Count;
|
total.Value = data.Count;
|
||||||
data = PageExtend.GetPageList(data, page, limit);
|
data = PageExtend.GetPageList(data, page, limit);
|
||||||
List<GameRankModel> result = new List<GameRankModel>();
|
List<GameRankModel> result = new List<GameRankModel>();
|
||||||
foreach (var item in data)
|
foreach (var item in data)
|
||||||
@@ -97,7 +97,7 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer
|
|||||||
.OrderByDescending(uc => uc.copper)
|
.OrderByDescending(uc => uc.copper)
|
||||||
.Take(100)
|
.Take(100)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
total = data.Count;
|
total.Value = data.Count;
|
||||||
data = PageExtend.GetPageList(data, page, limit);
|
data = PageExtend.GetPageList(data, page, limit);
|
||||||
List<GameRankModel> result = new List<GameRankModel>();
|
List<GameRankModel> result = new List<GameRankModel>();
|
||||||
foreach (var item in data)
|
foreach (var item in data)
|
||||||
@@ -120,10 +120,10 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer
|
|||||||
.Where((uc, u) => uc.lev > 29)
|
.Where((uc, u) => uc.lev > 29)
|
||||||
.Select<unit_user_attr>()
|
.Select<unit_user_attr>()
|
||||||
.OrderByDescending(uc => uc.lev)
|
.OrderByDescending(uc => uc.lev)
|
||||||
.OrderByDescending(uc=>uc.levUpdate)
|
.OrderBy(uc=>uc.levUpdate,OrderByType.Asc)
|
||||||
.Take(100)
|
.Take(100)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
total = data.Count;
|
total.Value = data.Count;
|
||||||
data = PageExtend.GetPageList(data, page, limit);
|
data = PageExtend.GetPageList(data, page, limit);
|
||||||
List<GameRankModel> result = new List<GameRankModel>();
|
List<GameRankModel> result = new List<GameRankModel>();
|
||||||
foreach (var item in data)
|
foreach (var item in data)
|
||||||
@@ -152,7 +152,7 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer
|
|||||||
.OrderByIF(type == 11, uc => uc.charm, OrderByType.Desc)
|
.OrderByIF(type == 11, uc => uc.charm, OrderByType.Desc)
|
||||||
.Take(100)
|
.Take(100)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
total = data.Count;
|
total.Value = data.Count;
|
||||||
data = PageExtend.GetPageList(data, page, limit);
|
data = PageExtend.GetPageList(data, page, limit);
|
||||||
List<GameRankModel> result = new List<GameRankModel>();
|
List<GameRankModel> result = new List<GameRankModel>();
|
||||||
foreach (var item in data)
|
foreach (var item in data)
|
||||||
|
|||||||
@@ -181,4 +181,11 @@ public class GameChatService : IGameChatService, ITransient
|
|||||||
.Where(it => it.chatId == chatId)
|
.Where(it => it.chatId == chatId)
|
||||||
.ExecuteCommandAsync() > 0;
|
.ExecuteCommandAsync() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task ClearChat()
|
||||||
|
{
|
||||||
|
long time = TimeExtend.GetTimeStampSeconds;
|
||||||
|
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_chat>();
|
||||||
|
await db.Deleteable<game_chat>().Where(it => it.delTime < time).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -57,12 +57,12 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
|||||||
}
|
}
|
||||||
|
|
||||||
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,int DealType)
|
int PageSize, RefAsync<int> Total, int DealType)
|
||||||
{
|
{
|
||||||
long onTime = TimeExtend.GetTimeStampSeconds;
|
long onTime = TimeExtend.GetTimeStampSeconds;
|
||||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
|
||||||
return await db.Queryable<unit_user_equ>().Where(it =>
|
return await db.Queryable<unit_user_equ>().Where(it =>
|
||||||
it.userId == userId && it.isOn == 0 && it.isLock == 0 &&
|
it.userId == userId && it.isOn == 0 && it.isLock == 0 &&
|
||||||
it.useEndTime > onTime)
|
it.useEndTime > onTime)
|
||||||
.WhereIF(DealType == 0, it => it.isDeal == 1)
|
.WhereIF(DealType == 0, it => it.isDeal == 1)
|
||||||
.WhereIF(DealType == 1, it => it.isDeal == 1 && it.isGive == 1)
|
.WhereIF(DealType == 1, it => it.isDeal == 1 && it.isGive == 1)
|
||||||
@@ -265,7 +265,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ue.minAtk = RandomAssist.GetFormatedNumeric((int)equ.minAtk, (int)equ.maxAtk);
|
ue.minAtk = RandomAssist.GetFormatedNumeric((int)equ.minAtk, (int)equ.maxAtk);
|
||||||
ue.maxAtk = RandomAssist.GetFormatedNumeric((int)equ.minAtk, (int)equ.maxAtk);
|
ue.maxAtk = RandomAssist.GetFormatedNumeric((int)ue.minAtk, (int)equ.maxAtk);
|
||||||
string[] def = equ.defense.Split('-');
|
string[] def = equ.defense.Split('-');
|
||||||
ue.Defense = RandomAssist.GetFormatedNumeric(Convert.ToInt32(def[0]), Convert.ToInt32(def[1]));
|
ue.Defense = RandomAssist.GetFormatedNumeric(Convert.ToInt32(def[0]), Convert.ToInt32(def[1]));
|
||||||
string[] agi = equ.agility.Split('-');
|
string[] agi = equ.agility.Split('-');
|
||||||
@@ -627,7 +627,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
|||||||
await redis.SetAsync(key, result, 300);
|
await redis.SetAsync(key, result, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result == null ? new List<AttrItem>() : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -827,7 +827,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
|||||||
|
|
||||||
private async Task<List<game_equ_make>> GetEquMakeData(int goodsId)
|
private async Task<List<game_equ_make>> GetEquMakeData(int goodsId)
|
||||||
{
|
{
|
||||||
string key = string.Format(BaseCache.BaseCacheKeys, "EquData", "EquUpData");
|
string key = string.Format(BaseCache.BaseCacheKeys, "EquData", "EquMakeData");
|
||||||
if (await redis.HExistsHashAsync(key, goodsId.ToString()))
|
if (await redis.HExistsHashAsync(key, goodsId.ToString()))
|
||||||
{
|
{
|
||||||
return await redis.GetHashAsync<List<game_equ_make>>(key, goodsId.ToString());
|
return await redis.GetHashAsync<List<game_equ_make>>(key, goodsId.ToString());
|
||||||
|
|||||||
@@ -94,7 +94,8 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
|||||||
|
|
||||||
public async Task<bool> AddFight(string fightId, string areaCode, string keyId, string mainId, string code,
|
public async Task<bool> AddFight(string fightId, string areaCode, string keyId, string mainId, string code,
|
||||||
string scene, string mapId,
|
string scene, string mapId,
|
||||||
string userId, long exp = 0, long copper = 0, long petExp = 0, string award = "", string pars = "")
|
string userId, long dueTime, long exp = 0, long copper = 0, long petExp = 0, string award = "",
|
||||||
|
string pars = "")
|
||||||
{
|
{
|
||||||
long addTime = TimeExtend.GetTimeStampMilliseconds;
|
long addTime = TimeExtend.GetTimeStampMilliseconds;
|
||||||
long endTime = TimeExtend.GetTimeStampSeconds + 24 * 60 * 60;
|
long endTime = TimeExtend.GetTimeStampSeconds + 24 * 60 * 60;
|
||||||
@@ -118,6 +119,7 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
|||||||
petExp = petExp,
|
petExp = petExp,
|
||||||
award = award,
|
award = award,
|
||||||
pars = pars,
|
pars = pars,
|
||||||
|
dueTime = dueTime,
|
||||||
addTime = addTime,
|
addTime = addTime,
|
||||||
okTime = 0,
|
okTime = 0,
|
||||||
endTime = endTime
|
endTime = endTime
|
||||||
@@ -161,6 +163,7 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<bool> SetFightWin(game_fight_data fightData, string winUser, bool setDefMap = true)
|
public async Task<bool> SetFightWin(game_fight_data fightData, string winUser, bool setDefMap = true)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
@@ -234,6 +237,10 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
|||||||
await UserStateTool.SetUserMapDefault(lowUser);
|
await UserStateTool.SetUserMapDefault(lowUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//战败后,结束挂机
|
||||||
|
var hookService = App.GetService<IOnHookService>();
|
||||||
|
await hookService.StopOnHook(lowUser);
|
||||||
|
|
||||||
fightData.state = 1;
|
fightData.state = 1;
|
||||||
fightData.winCode = nameof(UserEnum.AttrCode.Person);
|
fightData.winCode = nameof(UserEnum.AttrCode.Person);
|
||||||
fightData.winUser = winUser;
|
fightData.winUser = winUser;
|
||||||
@@ -375,6 +382,11 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
|||||||
|
|
||||||
public async Task HandleFight(game_fight_data fightData)
|
public async Task HandleFight(game_fight_data fightData)
|
||||||
{
|
{
|
||||||
|
if (await ValidFight(fightData) == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string winUser = fightData.winUser;
|
string winUser = fightData.winUser;
|
||||||
string lowUser = fightData.userId == winUser ? fightData.mainId : fightData.userId;
|
string lowUser = fightData.userId == winUser ? fightData.mainId : fightData.userId;
|
||||||
|
|
||||||
@@ -414,7 +426,7 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
|||||||
var cityInfo = await mapService.GetCityInfo((int)mapInfo.cityId);
|
var cityInfo = await mapService.GetCityInfo((int)mapInfo.cityId);
|
||||||
var winUserInfo = await userService.GetUserInfoByUserId(winUser);
|
var winUserInfo = await userService.GetUserInfoByUserId(winUser);
|
||||||
var lowUserInfo = await userService.GetUserInfoByUserId(lowUser);
|
var lowUserInfo = await userService.GetUserInfoByUserId(lowUser);
|
||||||
|
|
||||||
//系统广播
|
//系统广播
|
||||||
string boradMsg =
|
string boradMsg =
|
||||||
$"[{UbbTool.HomeUbb(winUserInfo.userNo, winUserInfo.nick)}]在{cityInfo.cityName}·{mapInfo.mapName}击杀了[{UbbTool.HomeUbb(lowUserInfo.userNo, lowUserInfo.nick)}]!";
|
$"[{UbbTool.HomeUbb(winUserInfo.userNo, winUserInfo.nick)}]在{cityInfo.cityName}·{mapInfo.mapName}击杀了[{UbbTool.HomeUbb(lowUserInfo.userNo, lowUserInfo.nick)}]!";
|
||||||
@@ -424,15 +436,38 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
|||||||
string noticeMsg =
|
string noticeMsg =
|
||||||
$"您在{cityInfo.cityName}·{mapInfo.mapName}被[{UbbTool.HomeUbb(winUserInfo.userNo, winUserInfo.nick)}]击杀!";
|
$"您在{cityInfo.cityName}·{mapInfo.mapName}被[{UbbTool.HomeUbb(winUserInfo.userNo, winUserInfo.nick)}]击杀!";
|
||||||
await chatService.SendChat(lowUser, (int)lowUserInfo.areaId, nameof(GameChatEnum.Code.Notice), noticeMsg);
|
await chatService.SendChat(lowUser, (int)lowUserInfo.areaId, nameof(GameChatEnum.Code.Notice), noticeMsg);
|
||||||
if (mapInfo.isPk == 1)
|
|
||||||
|
if (fightData.userId == winUser && fightData.scene == nameof(MapEnum.MapCode.DEF_MAP))
|
||||||
{
|
{
|
||||||
var relationService = App.GetService<IUnitUserRelationService>();
|
var relationService = App.GetService<IUnitUserRelationService>();
|
||||||
if (await relationService.CheckUserEnemy(winUser, lowUser) == false)
|
if (await relationService.CheckUserEnemy(winUser, lowUser) == false)
|
||||||
{
|
{
|
||||||
var accService = App.GetService<IUnitUserAccService>();
|
if (mapInfo.isPk == 1)
|
||||||
await accService.UpdateUserData(winUser, 1, nameof(AccEnum.AccType.enemy), 5, "击杀玩家"); //加罪恶
|
{
|
||||||
|
var accService = App.GetService<IUnitUserAccService>();
|
||||||
|
await accService.UpdateUserData(winUser, 1, nameof(AccEnum.AccType.enemy), 5,
|
||||||
|
"击杀玩家"); //加罪恶
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//执行扣除经验
|
||||||
|
var attrService = App.GetService<IUnitUserAttrService>();
|
||||||
|
await attrService.DeductUserExp(lowUser, 1, 1); //扣除1级
|
||||||
|
//设置回威尼斯
|
||||||
|
await mapService.UpdateUserOnMap(lowUser, "15_27");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region 场景处理
|
||||||
|
|
||||||
|
if (fightData.scene == nameof(MapEnum.MapCode.Magic_Map)) //魔城
|
||||||
|
{
|
||||||
|
var magicService = App.GetService<IGameMagicService>();
|
||||||
|
await magicService.UpdateUserMagicEndTime(lowUser, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -448,7 +483,7 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
|||||||
List<TowerGet> AddMapGoods = new List<TowerGet>();
|
List<TowerGet> AddMapGoods = new List<TowerGet>();
|
||||||
var opGoods = JsonConvert.DeserializeObject<List<TowerGet>>(fightAward.award.ToString());
|
var opGoods = JsonConvert.DeserializeObject<List<TowerGet>>(fightAward.award.ToString());
|
||||||
string addGoodsUser = fightData.areaCode == nameof(GameEnum.AreaCode.Public) ? "0" : fightData.winUser;
|
string addGoodsUser = fightData.areaCode == nameof(GameEnum.AreaCode.Public) ? "0" : fightData.winUser;
|
||||||
if (userConfig.autoBag == 1)
|
if (userConfig.autoBag != 0)
|
||||||
{
|
{
|
||||||
var weightService = App.GetService<IUnitUserWeight>();
|
var weightService = App.GetService<IUnitUserWeight>();
|
||||||
bool auto = true;
|
bool auto = true;
|
||||||
@@ -667,5 +702,26 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
|||||||
await Task.CompletedTask;
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<bool> ValidFight(game_fight_data fight, bool isBlack = true)
|
||||||
|
{
|
||||||
|
bool result = true;
|
||||||
|
if (fight.dueTime > 0)
|
||||||
|
{
|
||||||
|
int diffTime = Convert.ToInt32(fight.okTime - fight.addTime);
|
||||||
|
if (diffTime < 3000)
|
||||||
|
{
|
||||||
|
result = diffTime >= fight.dueTime;
|
||||||
|
if (result == false && isBlack) //异常处理
|
||||||
|
{
|
||||||
|
//封禁账号
|
||||||
|
var userService = App.GetService<IUnitUserService>();
|
||||||
|
await userService.BlackUser(fight.userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,7 @@ public class GameGoodsService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
|||||||
private async Task<long> GetUserDrugLockTime(string userId, int goodsId)
|
private async Task<long> GetUserDrugLockTime(string userId, int goodsId)
|
||||||
{
|
{
|
||||||
long result = 0;
|
long result = 0;
|
||||||
string key = string.Format(UserCache.BaseCacheKey, "UserDrug", $"Lock:{userId}_{goodsId}");
|
string key = string.Format(UserCache.BaseCacheKeys, "UserDrug", $"Lock:{userId}_{goodsId}");
|
||||||
if (await redis.ExistsAsync(key))
|
if (await redis.ExistsAsync(key))
|
||||||
{
|
{
|
||||||
long end = await redis.GetAsync<long>(key);
|
long end = await redis.GetAsync<long>(key);
|
||||||
@@ -225,7 +225,7 @@ public class GameGoodsService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
|||||||
if (time > 0)
|
if (time > 0)
|
||||||
{
|
{
|
||||||
long end = TimeExtend.GetTimeStampSeconds + time;
|
long end = TimeExtend.GetTimeStampSeconds + time;
|
||||||
string key = string.Format(UserCache.BaseCacheKey, "UserDrug", $"Lock:{userId}_{goodsId}");
|
string key = string.Format(UserCache.BaseCacheKeys, "UserDrug", $"Lock:{userId}_{goodsId}");
|
||||||
await redis.SetAsync(key, end, time);
|
await redis.SetAsync(key, end, time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,7 +235,8 @@ public class GameGoodsService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
|||||||
int result = 0;
|
int result = 0;
|
||||||
if (!string.IsNullOrEmpty(scene))
|
if (!string.IsNullOrEmpty(scene))
|
||||||
{
|
{
|
||||||
string key = string.Format(UserCache.BaseCacheKey, "UserDrug", $"Count:{scene}:{userId}_{goodsId}");
|
string maiId = $"Count:{scene}:{userId}_{goodsId}";
|
||||||
|
string key = string.Format(UserCache.BaseCacheKeys, "UserDrug", maiId);
|
||||||
if (await redis.ExistsAsync(key))
|
if (await redis.ExistsAsync(key))
|
||||||
{
|
{
|
||||||
result = await redis.GetAsync<int>(key);
|
result = await redis.GetAsync<int>(key);
|
||||||
@@ -251,7 +252,8 @@ public class GameGoodsService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
|
|||||||
{
|
{
|
||||||
var count = await GetUserDrugLockCount(userId, goodsId, scene);
|
var count = await GetUserDrugLockCount(userId, goodsId, scene);
|
||||||
count += 1;
|
count += 1;
|
||||||
string key = string.Format(UserCache.BaseCacheKey, "UserDrug", $"Count:{scene}:{userId}_{goodsId}");
|
string maiId = $"Count:{scene}:{userId}_{goodsId}";
|
||||||
|
string key = string.Format(UserCache.BaseCacheKeys, "UserDrug",maiId);
|
||||||
await redis.SetAsync(key, count, 43200);
|
await redis.SetAsync(key, count, 43200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
|||||||
};
|
};
|
||||||
if (item.code == nameof(MapEnum.NpcCode.Task))
|
if (item.code == nameof(MapEnum.NpcCode.Task))
|
||||||
{
|
{
|
||||||
var task = await taskService.GetTaskDataByNpc(userId,item.npcId);
|
var task = await taskService.GetTaskDataByNpc(userId, item.npcId);
|
||||||
if (task.Count > 0)
|
if (task.Count > 0)
|
||||||
{
|
{
|
||||||
temp.state = task.Any(it => it.state == 0) ? 1 : 2;
|
temp.state = task.Any(it => it.state == 0) ? 1 : 2;
|
||||||
@@ -218,9 +218,14 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateUserOnMap(string userId)
|
public async Task UpdateUserOnMap(string userId, string mapId = "")
|
||||||
{
|
{
|
||||||
unit_user_online onLine = await GetUserOnMap(userId);
|
unit_user_online onLine = await GetUserOnMap(userId);
|
||||||
|
if (!string.IsNullOrEmpty(mapId))
|
||||||
|
{
|
||||||
|
onLine.mapId = mapId;
|
||||||
|
}
|
||||||
|
|
||||||
onLine.upTime = TimeExtend.GetTimeStampSeconds;
|
onLine.upTime = TimeExtend.GetTimeStampSeconds;
|
||||||
string key = string.Format(UserCache.BaseCacheKey, "UserOnline");
|
string key = string.Format(UserCache.BaseCacheKey, "UserOnline");
|
||||||
if (await redis.AddHashAsync(key, userId, onLine))
|
if (await redis.AddHashAsync(key, userId, onLine))
|
||||||
@@ -400,7 +405,28 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
|||||||
|
|
||||||
#region 其他相关
|
#region 其他相关
|
||||||
|
|
||||||
private async Task<List<UserModel>> GetMapUser(string mapId, int area, int showArea, List<string> noUser)
|
public async Task<List<UserModel>> GetMapUserByAll(string mapId, int area, int showArea, List<string> noUser)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_online>();
|
||||||
|
var data = await db.Queryable<unit_user_online>().Where(it => it.mapId == mapId)
|
||||||
|
.WhereIF(noUser.Count > 0, it => !noUser.Contains(it.userId))
|
||||||
|
.OrderByDescending(it => it.upTime)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
List<UserModel> result = new List<UserModel>();
|
||||||
|
data.ForEach(async it =>
|
||||||
|
{
|
||||||
|
var temp = await UserModelTool.GetUserView(it.userId);
|
||||||
|
bool isAdd = showArea == 1 && area != temp.area ? false : true;
|
||||||
|
if (isAdd)
|
||||||
|
{
|
||||||
|
result.Add(temp);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<UserModel>> GetMapUser(string mapId, int area, int showArea, List<string> noUser)
|
||||||
{
|
{
|
||||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_online>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_online>();
|
||||||
long time = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddMinutes(0 - GameConfig.OnLineTime));
|
long time = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddMinutes(0 - GameConfig.OnLineTime));
|
||||||
|
|||||||
@@ -15,5 +15,15 @@ public class GameDicService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
|||||||
await redis.AddHashAsync(key, code, data);
|
await redis.AddHashAsync(key, code, data);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
public async Task<string> GetDicInfoContent(string code)
|
||||||
|
{
|
||||||
|
string result = string.Empty;
|
||||||
|
var data = await GetDicInfo(code);
|
||||||
|
if (data != null)
|
||||||
|
{
|
||||||
|
result = data.sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,39 +2,127 @@
|
|||||||
|
|
||||||
public class GameMaxNameService(ISqlSugarClient DbClient, IRedisCache redis) : IGameMaxNameService, ITransient
|
public class GameMaxNameService(ISqlSugarClient DbClient, IRedisCache redis) : IGameMaxNameService, ITransient
|
||||||
{
|
{
|
||||||
|
#region 资源
|
||||||
|
|
||||||
|
public async Task<game_maxname> GetMaxNameInfo(string mnId)
|
||||||
|
{
|
||||||
|
string key = string.Format(BaseCache.BaseCacheKey, "GameMaxName");
|
||||||
|
if (await redis.HExistsHashAsync(key, mnId))
|
||||||
|
{
|
||||||
|
return await redis.GetHashAsync<game_maxname>(key, mnId);
|
||||||
|
}
|
||||||
|
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_maxname>();
|
||||||
|
var data = await db.Queryable<game_maxname>().Where(i => i.mnId == mnId).SingleAsync();
|
||||||
|
if (data != null)
|
||||||
|
{
|
||||||
|
await redis.AddHashAsync(key, mnId, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region unit_user_maxname
|
#region unit_user_maxname
|
||||||
|
|
||||||
|
public async Task<bool> AddMaxName(string userId, string mnId, int addCount)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_maxname>();
|
||||||
|
bool isok = false;
|
||||||
|
string umnId = $"{userId}_{mnId}";
|
||||||
|
var data = await GetUserMaxnameInfo(umnId);
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
var mnInfo = await GetMaxNameInfo(mnId);
|
||||||
|
if (mnInfo != null)
|
||||||
|
{
|
||||||
|
unit_user_maxname mu = new unit_user_maxname();
|
||||||
|
mu.umnId = umnId;
|
||||||
|
mu.userId = userId;
|
||||||
|
mu.mnId = mnId;
|
||||||
|
mu.name = mnInfo.name;
|
||||||
|
mu.img = mnInfo.img;
|
||||||
|
mu.attr = mnInfo.attr;
|
||||||
|
mu.count = 1;
|
||||||
|
mu.addTime = DateTime.Now;
|
||||||
|
mu.endTime = DateTime.Now.AddDays(addCount);
|
||||||
|
mu.show = 0;
|
||||||
|
isok = db.Insertable(mu).ExecuteCommand() > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data.count = data.count + 1;
|
||||||
|
if (data.endTime > DateTime.Now)
|
||||||
|
{
|
||||||
|
data.endTime = Convert.ToDateTime(data.endTime).AddDays(addCount);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data.show = 0;
|
||||||
|
data.endTime = DateTime.Now.AddDays(addCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
isok = db.Updateable(data).IgnoreColumns(true, true).Where(i => i.umnId == data.umnId).ExecuteCommand() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isok)
|
||||||
|
{
|
||||||
|
await ClearUserMaxNameCache(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return isok;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<bool> UpdateUserMaxname(unit_user_maxname name)
|
public async Task<bool> UpdateUserMaxname(unit_user_maxname name)
|
||||||
{
|
{
|
||||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_maxname>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_maxname>();
|
||||||
bool isok = await db.Updateable(name).ExecuteCommandAsync() > 0;
|
bool isok = await db.Updateable(name).ExecuteCommandAsync() > 0;
|
||||||
if (isok)
|
|
||||||
{
|
|
||||||
string key = string.Format(BaseCache.BaseCacheKeys, "UserMaxname", "MaxnameInfo");
|
|
||||||
await redis.DelHashAsync(key, name.umnId);
|
|
||||||
}
|
|
||||||
return isok;
|
return isok;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<unit_user_maxname> GetUserMaxnameInfo(string umnId)
|
public async Task<unit_user_maxname> GetUserMaxnameInfo(string umnId)
|
||||||
{
|
{
|
||||||
string key = string.Format(BaseCache.BaseCacheKeys, "UserMaxname", "MaxnameInfo");
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_maxname>();
|
||||||
var data = await redis.GetHashAsync<unit_user_maxname>(key, umnId);
|
return await db.Queryable<unit_user_maxname>().Where(i => i.umnId == umnId).SingleAsync();
|
||||||
if (data == null)
|
|
||||||
{
|
|
||||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_maxname>();
|
|
||||||
data = await db.Queryable<unit_user_maxname>().Where(i => i.umnId == umnId).SingleAsync();
|
|
||||||
if (data != null)
|
|
||||||
{
|
|
||||||
await redis.AddHashAsync(key, umnId, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
public async Task<List<unit_user_maxname>> GetUserMaxnameList(string userId, int page, int limit, RefAsync<int> total)
|
|
||||||
|
public async Task<List<unit_user_maxname>> GetUserMaxnameList(string userId, int page, int limit,
|
||||||
|
RefAsync<int> total)
|
||||||
{
|
{
|
||||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_maxname>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_maxname>();
|
||||||
return await db.Queryable<unit_user_maxname>().Where(i => i.userId == userId).OrderBy(i => i.addTime)
|
return await db.Queryable<unit_user_maxname>().Where(i => i.userId == userId).OrderBy(i => i.addTime)
|
||||||
.ToPageListAsync(page, limit, total);
|
.ToPageListAsync(page, limit, total);
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
public async Task<List<unit_user_maxname>> GetUserMaxNameData(string userId)
|
||||||
|
{
|
||||||
|
string key = string.Format(UserCache.BaseCacheKey, "UserMaxName");
|
||||||
|
List<unit_user_maxname> data = new List<unit_user_maxname>();
|
||||||
|
if (await redis.HExistsHashAsync(key, userId))
|
||||||
|
{
|
||||||
|
data = await redis.GetHashAsync<List<unit_user_maxname>>(key, userId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_maxname>();
|
||||||
|
data = await db.Queryable<unit_user_maxname>().Where(i => i.userId == userId).ToListAsync();
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
data = new List<unit_user_maxname>();
|
||||||
|
}
|
||||||
|
await redis.AddHashAsync(key, userId, data);
|
||||||
|
}
|
||||||
|
return data.FindAll(it=>it.endTime > DateTime.Now);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ClearUserMaxNameCache(string userId)
|
||||||
|
{
|
||||||
|
string key = string.Format(UserCache.BaseCacheKey, "UserMaxName");
|
||||||
|
await redis.DelHashAsync(key,userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -194,7 +194,7 @@ public class MessageService(ISqlSugarClient DbClient, IRedisCache redis) : IMess
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ClearMailCountCache(string userId)
|
private async Task ClearMailCountCache(params string[] userId)
|
||||||
{
|
{
|
||||||
string key = string.Format(UserCache.BaseCacheKeys, "Message", "MailCount");
|
string key = string.Format(UserCache.BaseCacheKeys, "Message", "MailCount");
|
||||||
await redis.DelHashAsync(key, userId);
|
await redis.DelHashAsync(key, userId);
|
||||||
@@ -240,6 +240,42 @@ public class MessageService(ISqlSugarClient DbClient, IRedisCache redis) : IMess
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<bool> SendMaill(List<string> userIds, string name, string sign, List<TowerGet> award,
|
||||||
|
int days = 10)
|
||||||
|
{
|
||||||
|
List<unit_user_mail> data = new List<unit_user_mail>();
|
||||||
|
foreach (var userId in userIds)
|
||||||
|
{
|
||||||
|
unit_user_mail mail = new unit_user_mail();
|
||||||
|
mail.mailId = StringAssist.NewGuid;
|
||||||
|
mail.userId = userId;
|
||||||
|
mail.name = name;
|
||||||
|
mail.sign = sign;
|
||||||
|
mail.isRead = 0;
|
||||||
|
mail.isGet = award.Count > 0 ? 0 : 1;
|
||||||
|
mail.award = award;
|
||||||
|
mail.addTime = DateTime.Now;
|
||||||
|
mail.endTime = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddDays(days));
|
||||||
|
data.Add(mail);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.Count > 0)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_mail>();
|
||||||
|
bool result = await db.Insertable(data).ExecuteCommandAsync() > 0;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
await ClearMailCountCache(userIds.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<bool> UpdateMaillInfo(unit_user_mail data)
|
public async Task<bool> UpdateMaillInfo(unit_user_mail data)
|
||||||
{
|
{
|
||||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_mail>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_mail>();
|
||||||
@@ -368,17 +404,16 @@ public class MessageService(ISqlSugarClient DbClient, IRedisCache redis) : IMess
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> SendBroadcast(string userId, string code, string msg)
|
public async Task<bool> SendBroadcast(string userId, string code, string msg, int area = 0)
|
||||||
{
|
{
|
||||||
game_broadcast add = new game_broadcast();
|
game_broadcast add = new game_broadcast();
|
||||||
add.Id = StringAssist.NewGuid;
|
add.Id = StringAssist.NewGuid;
|
||||||
add.userId = userId;
|
add.userId = userId;
|
||||||
add.code = code;
|
add.code = code;
|
||||||
add.msg = msg;
|
add.msg = msg;
|
||||||
int area = 0;
|
|
||||||
if (add.userId == "0")
|
if (add.userId == "0")
|
||||||
{
|
{
|
||||||
add.area = 0;
|
add.area = area;
|
||||||
add.userNo = "0";
|
add.userNo = "0";
|
||||||
add.nick = "海精灵";
|
add.nick = "海精灵";
|
||||||
}
|
}
|
||||||
@@ -389,7 +424,6 @@ public class MessageService(ISqlSugarClient DbClient, IRedisCache redis) : IMess
|
|||||||
add.area = (int)userInfo.areaId;
|
add.area = (int)userInfo.areaId;
|
||||||
add.userNo = userInfo.userNo;
|
add.userNo = userInfo.userNo;
|
||||||
add.nick = userInfo.nick;
|
add.nick = userInfo.nick;
|
||||||
area = add.area;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add.endTime = TimeExtend.GetTimeStampSeconds + 300;
|
add.endTime = TimeExtend.GetTimeStampSeconds + 300;
|
||||||
@@ -399,4 +433,21 @@ public class MessageService(ISqlSugarClient DbClient, IRedisCache redis) : IMess
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public async Task HandleMessageData()
|
||||||
|
{
|
||||||
|
long time = TimeExtend.GetTimeStampSeconds;
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_message>();
|
||||||
|
|
||||||
|
await db.Deleteable<unit_user_mail>().Where(it => it.endTime < time && it.isRead == 1)
|
||||||
|
.ExecuteCommandAsync(); //清理邮件
|
||||||
|
await db.Deleteable<unit_user_message>().Where(it => it.endTime < time && it.isRead == 1)
|
||||||
|
.ExecuteCommandAsync(); //清理消息
|
||||||
|
await db.Deleteable<unit_user_message_event>().Where(it => it.endTime < time).ExecuteCommandAsync(); //清理通知
|
||||||
|
//删除缓存
|
||||||
|
string msgKey = string.Format(UserCache.BaseCacheKeys, "Message", "MsgCount");
|
||||||
|
string eventKey = string.Format(UserCache.BaseCacheKeys, "Message", "EventCount");
|
||||||
|
string mailKey = string.Format(UserCache.BaseCacheKeys, "Message", "MailCount");
|
||||||
|
await redis.DelAsync(msgKey, eventKey, mailKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace Application.Domain;
|
namespace Application.Domain;
|
||||||
|
|
||||||
public class NoticeService:INoticeService,ITransient
|
public class NoticeService : INoticeService, ITransient
|
||||||
{
|
{
|
||||||
private readonly ISqlSugarClient _dbClient;
|
private readonly ISqlSugarClient _dbClient;
|
||||||
private readonly IRedisCache _redisClient;
|
private readonly IRedisCache _redisClient;
|
||||||
@@ -14,13 +14,14 @@ public class NoticeService:INoticeService,ITransient
|
|||||||
public async Task<List<game_notice>> GetNoticeDataByTake(int take)
|
public async Task<List<game_notice>> GetNoticeDataByTake(int take)
|
||||||
{
|
{
|
||||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_notice>();
|
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_notice>();
|
||||||
return await db.Queryable<game_notice>().Take(take).OrderByDescending(it=>it.addTime).ToListAsync();
|
return await db.Queryable<game_notice>().Take(take).OrderByDescending(it => it.addTime).ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<game_notice>> GetNoticeData(int page, int limit, RefAsync<int> total)
|
public async Task<List<game_notice>> GetNoticeData(int page, int limit, RefAsync<int> total)
|
||||||
{
|
{
|
||||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_notice>();
|
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_notice>();
|
||||||
return await db.Queryable<game_notice>().OrderByDescending(it=>it.addTime).ToPageListAsync(page, limit, total);
|
return await db.Queryable<game_notice>().OrderByDescending(it => it.addTime)
|
||||||
|
.ToPageListAsync(page, limit, total);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<game_notice> GetNoticeInfo(string id)
|
public async Task<game_notice> GetNoticeInfo(string id)
|
||||||
@@ -28,4 +29,19 @@ public class NoticeService:INoticeService,ITransient
|
|||||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_notice>();
|
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_notice>();
|
||||||
return await db.Queryable<game_notice>().Where(it => it.noticeId == id).SingleAsync();
|
return await db.Queryable<game_notice>().Where(it => it.noticeId == id).SingleAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<game_notice>> GetNoticeDataByMap()
|
||||||
|
{
|
||||||
|
string key = string.Format(BaseCache.BaseCacheKey, "Notice");
|
||||||
|
if (await _redisClient.ExistsAsync(key))
|
||||||
|
{
|
||||||
|
return await _redisClient.GetAsync<List<game_notice>>(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
DateTime time = DateTime.Now;
|
||||||
|
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_notice>();
|
||||||
|
var data = await db.Queryable<game_notice>().OrderByDescending(it => it.endTime > time).ToListAsync();
|
||||||
|
await _redisClient.SetAsync(key, data, 3600);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,11 +2,19 @@
|
|||||||
|
|
||||||
public class TradeService(ISqlSugarClient DbClient, IRedisCache redis) : ITradeService, ITransient
|
public class TradeService(ISqlSugarClient DbClient, IRedisCache redis) : ITradeService, ITransient
|
||||||
{
|
{
|
||||||
public async Task<bool> AddTrade(string userId, string code,string name, string propId, int count,long price, string content)
|
public async Task<game_trade> GetTradeInfo(string tradeId)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_trade>();
|
||||||
|
return await db.Queryable<game_trade>().Where(it => it.tradeId == tradeId).SingleAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> AddTrade(int areaId, string userId, string code, string name, string propId, int count,
|
||||||
|
long price, string content)
|
||||||
{
|
{
|
||||||
game_trade trade = new game_trade()
|
game_trade trade = new game_trade()
|
||||||
{
|
{
|
||||||
tradeId = StringAssist.NewGuid,
|
tradeId = StringAssist.NewGuid,
|
||||||
|
areaId = areaId,
|
||||||
userId = userId,
|
userId = userId,
|
||||||
code = code,
|
code = code,
|
||||||
name = name,
|
name = name,
|
||||||
@@ -20,9 +28,47 @@ public class TradeService(ISqlSugarClient DbClient, IRedisCache redis) : ITradeS
|
|||||||
return await db.Insertable(trade).ExecuteCommandAsync() > 0;
|
return await db.Insertable(trade).ExecuteCommandAsync() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<bool> UpdateTradeCount(string tradeId, int op, int count, bool isDel = false)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_trade>();
|
||||||
|
if (isDel)
|
||||||
|
{
|
||||||
|
result = await db.Deleteable<game_trade>().Where(it => it.tradeId == tradeId).ExecuteCommandAsync() > 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int opCount = op == 1 ? count : (0 - count);
|
||||||
|
result = await db.Updateable<game_trade>()
|
||||||
|
.SetColumns(it => it.count == it.count + opCount)
|
||||||
|
.Where(it => it.tradeId == tradeId).ExecuteCommandAsync() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<int> GetUserTradeCount(string userId)
|
public async Task<int> GetUserTradeCount(string userId)
|
||||||
{
|
{
|
||||||
var db = DbClient.AsTenant().GetConnectionWithAttr<game_trade>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_trade>();
|
||||||
return await db.Queryable<game_trade>().Where(it => it.userId == userId).CountAsync();
|
return await db.Queryable<game_trade>().Where(it => it.userId == userId).CountAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<game_trade>> GetUserTradeData(string userId)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_trade>();
|
||||||
|
return await db.Queryable<game_trade>().Where(it => it.userId == userId).ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<game_trade>> GetUserTradeData(int areaId, string userId, int type, string query, int page, int limit,
|
||||||
|
RefAsync<int> total)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_trade>();
|
||||||
|
return await db.Queryable<game_trade>().Where(it=>it.areaId==areaId)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(userId), it => it.userId == userId)
|
||||||
|
.WhereIF(type==1,it=>it.code=="Equ")
|
||||||
|
.WhereIF(type==2,it=>it.code=="Goods")
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(query),it=>it.name.Contains(query))
|
||||||
|
.OrderByDescending(it=>it.addTime)
|
||||||
|
.ToPageListAsync(page, limit, total);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -434,16 +434,12 @@ public class GameTaskService(ISqlSugarClient DbClient, IRedisCache redis) : IGam
|
|||||||
var taskInfo = await GetTaskInfo(taskId);
|
var taskInfo = await GetTaskInfo(taskId);
|
||||||
if (taskInfo != null)
|
if (taskInfo != null)
|
||||||
{
|
{
|
||||||
if (taskInfo.time == 0)
|
result = TimeExtend.GetTimeStampSecondsByCode(taskInfo.timeSpan, DateTime.Now.AddYears(20));
|
||||||
|
if (result == 0)
|
||||||
{
|
{
|
||||||
result += 3650 * 24 * 60 * 60;
|
result = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddYears(20));
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result += (int)taskInfo.time * 60;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace Application.Domain;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) : IUnitUserAttrService, ITransient
|
public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) : IUnitUserAttrService, ITransient
|
||||||
{
|
{
|
||||||
@@ -6,138 +8,144 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
|
|||||||
|
|
||||||
public async Task<UserAttrModel> GetUserAttrModel(string userId, string scene = "Default")
|
public async Task<UserAttrModel> GetUserAttrModel(string userId, string scene = "Default")
|
||||||
{
|
{
|
||||||
UserAttrModel result = new UserAttrModel();
|
try
|
||||||
result.id = userId;
|
|
||||||
var userService = App.GetService<IUnitUserService>();
|
|
||||||
var userInfo = await userService.GetUserInfoByUserId(userId);
|
|
||||||
result.viceId = userInfo.userNo;
|
|
||||||
result.name = userInfo.nick;
|
|
||||||
result.area = (int)userInfo.areaId;
|
|
||||||
result.IsSystem = (int)userInfo.isSystem;
|
|
||||||
result.sex = userInfo.sex;
|
|
||||||
result.code = nameof(UserEnum.AttrCode.Person);
|
|
||||||
var unitAttr = await GetUserAttr(userId);
|
|
||||||
result.lev = (int)unitAttr.lev;
|
|
||||||
result.minAtk = (int)unitAttr.minAtk;
|
|
||||||
result.maxAtk = (int)unitAttr.maxAtk;
|
|
||||||
result.defense = (int)unitAttr.defense;
|
|
||||||
result.agility = (int)unitAttr.agility;
|
|
||||||
result.upBlood = (int)unitAttr.upBlood;
|
|
||||||
result.upMorale = (int)unitAttr.upMorale;
|
|
||||||
|
|
||||||
List<AttrItem> ExtendAttrData = new List<AttrItem>();
|
|
||||||
|
|
||||||
#region 构造基础加层体系
|
|
||||||
|
|
||||||
UserAttrModel temp = new UserAttrModel();
|
|
||||||
temp.minAtk = (int)unitAttr.minAtk;
|
|
||||||
temp.maxAtk = (int)unitAttr.maxAtk;
|
|
||||||
temp.defense = (int)unitAttr.defense;
|
|
||||||
temp.agility = (int)unitAttr.agility;
|
|
||||||
temp.upBlood = (int)unitAttr.upBlood;
|
|
||||||
temp.upMorale = (int)unitAttr.upMorale;
|
|
||||||
|
|
||||||
var equService = App.GetService<IGameEquService>();
|
|
||||||
var equTemp = await equService.GetUserEquAttrModel(userId);
|
|
||||||
temp = GameAttrTool.GetRoleAttrTempMerge(temp, equTemp);
|
|
||||||
//套装加层
|
|
||||||
var suitAttr = await equService.GetUserEquSuitAttrInfo(userId);
|
|
||||||
ExtendAttrData.AddRange(suitAttr);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region 参数
|
|
||||||
|
|
||||||
int minAtk = 0;
|
|
||||||
int maxAtk = 0;
|
|
||||||
int Agility = 0;
|
|
||||||
int Defense = 0;
|
|
||||||
int upBlood = 0;
|
|
||||||
int upMorale = 0;
|
|
||||||
|
|
||||||
#endregion 参数
|
|
||||||
|
|
||||||
#region 队伍加层
|
|
||||||
|
|
||||||
var teamService = App.GetService<IGameTeamService>();
|
|
||||||
var MyTeam = await teamService.GetUserTeamInfo(userId);
|
|
||||||
if (MyTeam.state == 1)
|
|
||||||
{
|
{
|
||||||
int teamCount = MyTeam.user.Count(it => it.isOnline == 1);
|
UserAttrModel result = new UserAttrModel();
|
||||||
if (teamCount > 0)
|
result.id = userId;
|
||||||
|
var userService = App.GetService<IUnitUserService>();
|
||||||
|
var userInfo = await userService.GetUserInfoByUserId(userId);
|
||||||
|
result.viceId = userInfo.userNo;
|
||||||
|
result.name = userInfo.nick;
|
||||||
|
result.area = (int)userInfo.areaId;
|
||||||
|
result.IsSystem = (int)userInfo.isSystem;
|
||||||
|
result.sex = userInfo.sex;
|
||||||
|
result.code = nameof(UserEnum.AttrCode.Person);
|
||||||
|
var unitAttr = await GetUserAttr(userId);
|
||||||
|
result.lev = (int)unitAttr.lev;
|
||||||
|
result.minAtk = (int)unitAttr.minAtk;
|
||||||
|
result.maxAtk = (int)unitAttr.maxAtk;
|
||||||
|
result.defense = (int)unitAttr.defense;
|
||||||
|
result.agility = (int)unitAttr.agility;
|
||||||
|
result.upBlood = (int)unitAttr.upBlood;
|
||||||
|
result.upMorale = (int)unitAttr.upMorale;
|
||||||
|
|
||||||
|
List<AttrItem> ExtendAttrData = new List<AttrItem>();
|
||||||
|
|
||||||
|
#region 构造基础加层体系
|
||||||
|
|
||||||
|
UserAttrModel temp = new UserAttrModel();
|
||||||
|
temp.minAtk = (int)unitAttr.minAtk;
|
||||||
|
temp.maxAtk = (int)unitAttr.maxAtk;
|
||||||
|
temp.defense = (int)unitAttr.defense;
|
||||||
|
temp.agility = (int)unitAttr.agility;
|
||||||
|
temp.upBlood = (int)unitAttr.upBlood;
|
||||||
|
temp.upMorale = (int)unitAttr.upMorale;
|
||||||
|
|
||||||
|
var equService = App.GetService<IGameEquService>();
|
||||||
|
var equTemp = await equService.GetUserEquAttrModel(userId);
|
||||||
|
temp = GameAttrTool.GetRoleAttrTempMerge(temp, equTemp);
|
||||||
|
//套装加层
|
||||||
|
var suitAttr = await equService.GetUserEquSuitAttrInfo(userId);
|
||||||
|
ExtendAttrData.AddRange(suitAttr);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 参数
|
||||||
|
|
||||||
|
int minAtk = 0;
|
||||||
|
int maxAtk = 0;
|
||||||
|
int Agility = 0;
|
||||||
|
int Defense = 0;
|
||||||
|
int upBlood = 0;
|
||||||
|
int upMorale = 0;
|
||||||
|
|
||||||
|
#endregion 参数
|
||||||
|
|
||||||
|
#region 队伍加层
|
||||||
|
|
||||||
|
var teamService = App.GetService<IGameTeamService>();
|
||||||
|
var MyTeam = await teamService.GetUserTeamInfo(userId);
|
||||||
|
if (MyTeam.state == 1)
|
||||||
{
|
{
|
||||||
decimal teamAdd = 0.05m * teamCount;
|
int teamCount = MyTeam.user.Count(it => it.isOnline == 1);
|
||||||
teamAdd = teamAdd > 0.2m ? 0.2m : teamAdd;
|
if (teamCount > 0)
|
||||||
minAtk += Convert.ToInt32(temp.minAtk * teamAdd);
|
{
|
||||||
maxAtk += Convert.ToInt32(temp.maxAtk * teamAdd);
|
decimal teamAdd = 0.05m * teamCount;
|
||||||
Defense += Convert.ToInt32(temp.defense * teamAdd);
|
teamAdd = teamAdd > 0.2m ? 0.2m : teamAdd;
|
||||||
result.atkTips += $"(队+{Convert.ToInt32(teamAdd * 100)}%)";
|
minAtk += Convert.ToInt32(temp.minAtk * teamAdd);
|
||||||
result.defTips += $"(队+{Convert.ToInt32(teamAdd * 100)}%)";
|
maxAtk += Convert.ToInt32(temp.maxAtk * teamAdd);
|
||||||
|
Defense += Convert.ToInt32(temp.defense * teamAdd);
|
||||||
|
result.atkTips += $"(队+{Convert.ToInt32(teamAdd * 100)}%)";
|
||||||
|
result.defTips += $"(队+{Convert.ToInt32(teamAdd * 100)}%)";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 称号加层
|
||||||
|
|
||||||
|
var maxNameService = App.GetService<IGameMaxNameService>();
|
||||||
|
var userMaxName = await maxNameService.GetUserMaxNameData(userId);
|
||||||
|
foreach (var maxName in userMaxName)
|
||||||
|
{
|
||||||
|
ExtendAttrData.AddRange(maxName.attr);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region Buff加层
|
||||||
|
|
||||||
|
var MyState = await GetUserStateData(userId, scene);
|
||||||
|
if (MyState.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in MyState)
|
||||||
|
{
|
||||||
|
ExtendAttrData.AddRange(item.attr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 加层处理
|
||||||
|
|
||||||
|
var otTemp = GameAttrTool.GetRoleAttrTemp(temp, ExtendAttrData);
|
||||||
|
|
||||||
|
result = GameAttrTool.GetRoleAttrTempMerge(result, otTemp); //加层其他
|
||||||
|
result = GameAttrTool.GetRoleAttrTempMerge(result, temp); //加层其他
|
||||||
|
result.minAtk += minAtk;
|
||||||
|
result.maxAtk += maxAtk;
|
||||||
|
result.defense += Defense;
|
||||||
|
result.agility += Agility;
|
||||||
|
result.upBlood += upBlood;
|
||||||
|
result.upMorale += upMorale;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 数据效验
|
||||||
|
|
||||||
|
var userBlood = await GetUserBlood(userId);
|
||||||
|
result.blood = (int)userBlood.blood;
|
||||||
|
|
||||||
|
//士气
|
||||||
|
var userMorale = await GetUserMorale(userId);
|
||||||
|
result.morale = (int)userMorale.morale;
|
||||||
|
|
||||||
|
//负面状态处理
|
||||||
|
var loadState = await GetUserLoadState(userId);
|
||||||
|
result = await GameAttrTool.CheckRoleLoadBuff(result, loadState);
|
||||||
|
result = await ReviseUserRoleAttr(result);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Buff加层
|
|
||||||
|
|
||||||
var MyState = await GetUserStateData(userId, scene);
|
|
||||||
if (MyState.Count > 0)
|
|
||||||
{
|
{
|
||||||
foreach (var item in MyState)
|
Console.WriteLine($"错误ID:{userId},错误信息:{e.Message}");
|
||||||
{
|
throw;
|
||||||
minAtk += Convert.ToInt32(GameAttrTool.GetAttrItemValue(GameEnum.AttrCode.Atk.ToString(), item.attr,
|
|
||||||
temp.minAtk));
|
|
||||||
maxAtk += Convert.ToInt32(GameAttrTool.GetAttrItemValue(GameEnum.AttrCode.Atk.ToString(), item.attr,
|
|
||||||
temp.maxAtk));
|
|
||||||
Defense += Convert.ToInt32(GameAttrTool.GetAttrItemValue(GameEnum.AttrCode.Defense.ToString(),
|
|
||||||
item.attr, temp.defense));
|
|
||||||
Agility += Convert.ToInt32(GameAttrTool.GetAttrItemValue(GameEnum.AttrCode.Agility.ToString(),
|
|
||||||
item.attr, temp.agility));
|
|
||||||
upBlood += Convert.ToInt32(GameAttrTool.GetAttrItemValue(GameEnum.AttrCode.Blood.ToString(), item.attr,
|
|
||||||
temp.upBlood));
|
|
||||||
upMorale += Convert.ToInt32(GameAttrTool.GetAttrItemValue(GameEnum.AttrCode.Morale.ToString(),
|
|
||||||
item.attr, temp.upMorale));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 加层处理
|
|
||||||
|
|
||||||
var otTemp = GameAttrTool.GetRoleAttrTemp(temp, ExtendAttrData);
|
|
||||||
result = GameAttrTool.GetRoleAttrTempMerge(result, otTemp); //加层其他
|
|
||||||
result = GameAttrTool.GetRoleAttrTempMerge(result, temp); //加层其他
|
|
||||||
|
|
||||||
result.minAtk += minAtk;
|
|
||||||
result.maxAtk += maxAtk;
|
|
||||||
result.defense += Defense;
|
|
||||||
result.agility += Agility;
|
|
||||||
result.upBlood += upBlood;
|
|
||||||
result.upMorale += upMorale;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 数据效验
|
|
||||||
|
|
||||||
var userBlood = await GetUserBlood(userId);
|
|
||||||
result.blood = (int)userBlood.blood;
|
|
||||||
|
|
||||||
//士气
|
|
||||||
var userMorale = await GetUserMorale(userId);
|
|
||||||
result.morale = (int)userMorale.morale;
|
|
||||||
|
|
||||||
//负面状态处理
|
|
||||||
var loadState = await GetUserLoadState(userId);
|
|
||||||
result = await GameAttrTool.CheckRoleLoadBuff(result, loadState);
|
|
||||||
result = await ReviseUserRoleAttr(result);
|
|
||||||
return result;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<UserAttrModel> ReviseUserRoleAttr(UserAttrModel result)
|
private async Task<UserAttrModel> ReviseUserRoleAttr(UserAttrModel result)
|
||||||
@@ -282,12 +290,16 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_exp>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_exp>();
|
||||||
await DbClient.AsTenant().BeginTranAsync();
|
|
||||||
if (op == 0) //扣除经验
|
if (op == 0) //扣除经验
|
||||||
{
|
{
|
||||||
result = await db.Updateable<unit_user_exp>().SetColumns(it => it.exp == it.exp - exp)
|
result = await db.Updateable<unit_user_exp>().SetColumns(it => it.exp == it.exp - exp)
|
||||||
.Where(it => it.userId == userId).ExecuteCommandAsync() > 0;
|
.Where(it => it.userId == userId).ExecuteCommandAsync() > 0;
|
||||||
}
|
}
|
||||||
|
else if (op == 2) //固定经验
|
||||||
|
{
|
||||||
|
result = await db.Updateable<unit_user_exp>().SetColumns(it => it.exp == exp)
|
||||||
|
.Where(it => it.userId == userId).ExecuteCommandAsync() > 0;
|
||||||
|
}
|
||||||
else //增加经验
|
else //增加经验
|
||||||
{
|
{
|
||||||
var MyExp = await db.Queryable<unit_user_exp>().Where(it => it.userId == userId).SingleAsync();
|
var MyExp = await db.Queryable<unit_user_exp>().Where(it => it.userId == userId).SingleAsync();
|
||||||
@@ -300,43 +312,44 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
|
|||||||
else //足够升级
|
else //足够升级
|
||||||
{
|
{
|
||||||
var myAttr = await GetUserAttr(userId);
|
var myAttr = await GetUserAttr(userId);
|
||||||
int OnLev = (int)myAttr.lev + 1;
|
int OnLev = (int)myAttr.lev;
|
||||||
if (OnLev <= GameConfig.GameMaxLev)
|
if (OnLev >= GameConfig.GameMaxLev)
|
||||||
{
|
{
|
||||||
long upExp = onExp - (long)MyExp.upExp;
|
return true;
|
||||||
decimal nextExp = GameTool.GetUserUpExp(OnLev);
|
}
|
||||||
result = await db.Updateable<unit_user_exp>().SetColumns(it => it.exp == upExp)
|
|
||||||
.SetColumns(it => it.upExp == nextExp).Where(it => it.userId == userId)
|
|
||||||
.ExecuteCommandAsync() > 0;
|
|
||||||
if (result) //更新成功,更新各项属性
|
|
||||||
{
|
|
||||||
var data = GameTool.GetAttrData(OnLev);
|
|
||||||
result = await db.Updateable<unit_user_attr>(data).Where(i => i.userId == userId)
|
|
||||||
.ExecuteCommandAsync() > 0;
|
|
||||||
int upVigour = GameConfig.GameBaseVigour + (OnLev * 10);
|
|
||||||
await UpdateUserUpVigour(userId, upVigour);
|
|
||||||
|
|
||||||
IsUpUserAttr = result;
|
long upExp = (long)MyExp.upExp;
|
||||||
|
|
||||||
|
while (onExp >= upExp)
|
||||||
|
{
|
||||||
|
if (OnLev < GameConfig.GameMaxLev)
|
||||||
|
{
|
||||||
|
OnLev = OnLev + 1;
|
||||||
|
onExp -= upExp;
|
||||||
|
upExp = GameTool.GetUserUpExp(OnLev);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
result = await db.Updateable<unit_user_exp>().SetColumns(it => it.exp == onExp)
|
||||||
|
.SetColumns(it => it.upExp == upExp).Where(it => it.userId == userId)
|
||||||
|
.ExecuteCommandAsync() > 0;
|
||||||
|
if (result) //更新成功,更新各项属性
|
||||||
{
|
{
|
||||||
decimal maxOnExp = (decimal)MyExp.upExp - 1;
|
var data = GameTool.GetAttrData(OnLev);
|
||||||
if ((decimal)MyExp.exp < maxOnExp)
|
result = await db.Updateable<unit_user_attr>(data).Where(i => i.userId == userId)
|
||||||
{
|
.ExecuteCommandAsync() > 0;
|
||||||
result = await db.Updateable<unit_user_exp>().SetColumns(it => it.exp == maxOnExp)
|
IsUpUserAttr = result;
|
||||||
.Where(it => it.userId == userId).ExecuteCommandAsync() > 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await DbClient.AsTenant().CommitTranAsync();
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
result = false;
|
result = false;
|
||||||
await DbClient.AsTenant().RollbackTranAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result && IsUpUserAttr)
|
if (result && IsUpUserAttr)
|
||||||
@@ -347,6 +360,82 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task DeductUserExp(string userId, int type, long count)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
var userAttr = await GetUserAttr(userId);
|
||||||
|
int OnLev = (int)userAttr.lev;
|
||||||
|
if (OnLev <= 30)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var userExp = await GetUserExp(userId);
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_exp>();
|
||||||
|
if (type == 0) //扣除经验
|
||||||
|
{
|
||||||
|
long sumExp = (long)userExp.exp;
|
||||||
|
while (count > 0 && OnLev > 30)
|
||||||
|
{
|
||||||
|
if (sumExp >= count)
|
||||||
|
{
|
||||||
|
count = 0;
|
||||||
|
sumExp = sumExp - count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OnLev -= 1;
|
||||||
|
sumExp += GameTool.GetUserUpExp(OnLev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OnLev == 30)
|
||||||
|
{
|
||||||
|
sumExp = 0;
|
||||||
|
}
|
||||||
|
var data = GameTool.GetAttrData(OnLev);
|
||||||
|
result = await db.Updateable<unit_user_attr>(data).Where(i => i.userId == userId)
|
||||||
|
.ExecuteCommandAsync() > 0;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
await UpdateUserExp(userId, sumExp, 2);
|
||||||
|
await ClearUserAttrCache(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(type==1) //扣除等级
|
||||||
|
{
|
||||||
|
OnLev -= Convert.ToInt32(count);
|
||||||
|
var data = GameTool.GetAttrData(OnLev);
|
||||||
|
result = await db.Updateable<unit_user_attr>(data).Where(i => i.userId == userId)
|
||||||
|
.ExecuteCommandAsync() > 0;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
if (userExp.exp > 0)
|
||||||
|
{
|
||||||
|
await UpdateUserExp(userId, 0, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
await ClearUserAttrCache(userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//下装备
|
||||||
|
var equService = App.GetService<IGameEquService>();
|
||||||
|
var onEqu = await equService.GetUserOnEqu(userId);
|
||||||
|
onEqu = onEqu.FindAll(it => it.lev > OnLev);
|
||||||
|
if (onEqu.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in onEqu)
|
||||||
|
{
|
||||||
|
await equService.EquOnOrDown(item, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion 经验操作
|
#endregion 经验操作
|
||||||
|
|
||||||
#region 士气
|
#region 士气
|
||||||
@@ -439,7 +528,7 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
|
|||||||
if (op == 1)
|
if (op == 1)
|
||||||
{
|
{
|
||||||
var userVigour = await GetUserVigourInfo(userId);
|
var userVigour = await GetUserVigourInfo(userId);
|
||||||
long endVigour = (long)userVigour.upVitality - (long)userVigour.vitality;
|
long endVigour = await GetUserMaxVitality(userId) - (long)userVigour.vitality;
|
||||||
count = endVigour > count ? count : endVigour;
|
count = endVigour > count ? count : endVigour;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,17 +559,11 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> UpdateUserUpVigour(string userId, decimal count)
|
|
||||||
{
|
|
||||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_vigour>();
|
|
||||||
bool isok = await db.Updateable<unit_user_vigour>().SetColumns(i => i.upVitality == count)
|
|
||||||
.Where(i => i.userId == userId).ExecuteCommandAsync() > 0;
|
|
||||||
if (isok)
|
|
||||||
{
|
|
||||||
await ClearUserVigourCache(userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return isok;
|
public async Task<long> GetUserMaxVitality(string userId)
|
||||||
|
{
|
||||||
|
var OnLev = await GetUserLev(userId);
|
||||||
|
return GameConfig.GameBaseVigour + (OnLev * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion 活力
|
#endregion 活力
|
||||||
@@ -514,7 +597,7 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
|
|||||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_online_time>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_online_time>();
|
||||||
await db.Updateable<unit_user_online_time>().SetColumns(it => it.dayTime == 0)
|
await db.Updateable<unit_user_online_time>().SetColumns(it => it.dayTime == 0)
|
||||||
.WhereIF(day == 1, it => it.monthTime == 0)
|
.WhereIF(day == 1, it => it.monthTime == 0)
|
||||||
.Where(it => true).ExecuteCommandAsync();
|
.Where(it => it.userId != "0").ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -595,13 +678,15 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
|
|||||||
var data = await redis.GetHashAsync<List<unit_user_state>>(key, userId);
|
var data = await redis.GetHashAsync<List<unit_user_state>>(key, userId);
|
||||||
if (data == null)
|
if (data == null)
|
||||||
{
|
{
|
||||||
long endTime = TimeExtend.GetTimeStampSeconds;
|
|
||||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_state>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_state>();
|
||||||
data = await db.Queryable<unit_user_state>().Where(it => it.userId == userId && it.endTime > endTime)
|
data = await db.Queryable<unit_user_state>().Where(it => it.userId == userId)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
await redis.AddHashAsync(key, userId, data);
|
await redis.AddHashAsync(key, userId, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long endTime = TimeExtend.GetTimeStampSeconds;
|
||||||
|
data = data.FindAll(it => it.endTime > endTime);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ namespace Application.Domain;
|
|||||||
|
|
||||||
public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUnitUserService, ITransient
|
public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUnitUserService, ITransient
|
||||||
{
|
{
|
||||||
|
|
||||||
#region 用户信息
|
#region 用户信息
|
||||||
|
|
||||||
public async Task<List<unit_user>> GetUserDataByAccId(string accId)
|
public async Task<List<unit_user>> GetUserDataByAccId(string accId)
|
||||||
@@ -101,6 +100,7 @@ public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUni
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> UpdateUserSex(string userId, string sex)
|
public async Task<bool> UpdateUserSex(string userId, string sex)
|
||||||
{
|
{
|
||||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user>();
|
||||||
@@ -113,6 +113,7 @@ public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUni
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> UpdateUserSign(string userId, string sign)
|
public async Task<bool> UpdateUserSign(string userId, string sign)
|
||||||
{
|
{
|
||||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user>();
|
||||||
@@ -126,6 +127,21 @@ public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUni
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<bool> BlackUser(string userId)
|
||||||
|
{
|
||||||
|
string newToken = await GetToken();
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user>();
|
||||||
|
bool result = await db.Updateable<unit_user>().SetColumns(it => it.status == 0)
|
||||||
|
.SetColumns(it => it.token == newToken)
|
||||||
|
.Where(it => it.userId == userId).ExecuteCommandAsync() > 0;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
await ClearUserInfo(0, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 用户注册
|
#region 用户注册
|
||||||
@@ -186,7 +202,7 @@ public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUni
|
|||||||
acc.cowry = 0;
|
acc.cowry = 0;
|
||||||
acc.gold = 0;
|
acc.gold = 0;
|
||||||
db.Insertable(acc).AddQueue();
|
db.Insertable(acc).AddQueue();
|
||||||
|
|
||||||
unit_user_data userData = new unit_user_data();
|
unit_user_data userData = new unit_user_data();
|
||||||
userData.userId = userId;
|
userData.userId = userId;
|
||||||
userData.teach = 0;
|
userData.teach = 0;
|
||||||
@@ -204,7 +220,7 @@ public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUni
|
|||||||
unit_user_attr userAttr = GameTool.GetAttrData(1);
|
unit_user_attr userAttr = GameTool.GetAttrData(1);
|
||||||
userAttr.userId = userId;
|
userAttr.userId = userId;
|
||||||
db.Insertable(userAttr).AddQueue();
|
db.Insertable(userAttr).AddQueue();
|
||||||
|
|
||||||
//注册配置
|
//注册配置
|
||||||
unit_user_config config = new unit_user_config();
|
unit_user_config config = new unit_user_config();
|
||||||
config.userId = userId;
|
config.userId = userId;
|
||||||
@@ -244,7 +260,6 @@ public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUni
|
|||||||
unit_user_vigour vitality = new unit_user_vigour();
|
unit_user_vigour vitality = new unit_user_vigour();
|
||||||
vitality.userId = userId;
|
vitality.userId = userId;
|
||||||
vitality.vitality = GameConfig.GameBaseVigour;
|
vitality.vitality = GameConfig.GameBaseVigour;
|
||||||
vitality.upVitality = GameConfig.GameBaseVigour;
|
|
||||||
vitality.upTime = TimeAssist.GetDateTimeYMDString(-1);
|
vitality.upTime = TimeAssist.GetDateTimeYMDString(-1);
|
||||||
db.Insertable(vitality).AddQueue();
|
db.Insertable(vitality).AddQueue();
|
||||||
|
|
||||||
@@ -262,7 +277,7 @@ public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUni
|
|||||||
onlineTime.monthTime = 0;
|
onlineTime.monthTime = 0;
|
||||||
onlineTime.totalTime = 0;
|
onlineTime.totalTime = 0;
|
||||||
db.Insertable(onlineTime).AddQueue();
|
db.Insertable(onlineTime).AddQueue();
|
||||||
|
|
||||||
//注册队伍
|
//注册队伍
|
||||||
unit_user_team team = new unit_user_team();
|
unit_user_team team = new unit_user_team();
|
||||||
team.userId = userId;
|
team.userId = userId;
|
||||||
@@ -272,9 +287,8 @@ public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUni
|
|||||||
await db.SaveQueuesAsync(false);
|
await db.SaveQueuesAsync(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result)//注册各项后处理
|
if (result) //注册各项后处理
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -323,9 +337,15 @@ public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUni
|
|||||||
return await db.Queryable<unit_user_online>().Where(it => it.upTime > time).CountAsync();
|
return await db.Queryable<unit_user_online>().Where(it => it.upTime > time).CountAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<unit_user_online>> GetOnlineUserByTime(long time)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_online>();
|
||||||
|
return await db.Queryable<unit_user_online>().Where(it => it.upTime > time).ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 权限配置
|
#region 权限配置
|
||||||
|
|
||||||
public async Task<unit_user_config> GetUserConfigInfo(string userId)
|
public async Task<unit_user_config> GetUserConfigInfo(string userId)
|
||||||
{
|
{
|
||||||
@@ -365,8 +385,8 @@ public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUni
|
|||||||
case "MsgRole":
|
case "MsgRole":
|
||||||
result = (int)config.msgRole;
|
result = (int)config.msgRole;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,6 +415,5 @@ public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUni
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -112,6 +112,11 @@ public class UnitUserWeight(ISqlSugarClient DbClient, IRedisCache redis) : IUnit
|
|||||||
|
|
||||||
public async Task<bool> CheckUserWeight(string userId, int useWeight)
|
public async Task<bool> CheckUserWeight(string userId, int useWeight)
|
||||||
{
|
{
|
||||||
|
if (useWeight <= 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
var weightInfo = await GetUserWeightInfo(userId);
|
var weightInfo = await GetUserWeightInfo(userId);
|
||||||
if (weightInfo != null)
|
if (weightInfo != null)
|
||||||
|
|||||||
65
Service/Application.Domain/Tool/Base/FightTool.cs
Normal file
65
Service/Application.Domain/Tool/Base/FightTool.cs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
|
public class FightTool
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 攻击冷却时间
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="atk"></param>
|
||||||
|
/// <param name="def"></param>
|
||||||
|
/// <param name="loads"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int GetFightCool(long atk, long def, List<unit_user_load> loads = null)
|
||||||
|
{
|
||||||
|
int result = 1000;
|
||||||
|
if (atk > def && def > 0)
|
||||||
|
{
|
||||||
|
decimal diff = atk - def;
|
||||||
|
decimal bl = diff / def;
|
||||||
|
result = Convert.ToInt32((1 - bl) * result);
|
||||||
|
result = result < 300 ? 300 : result;
|
||||||
|
result = result > 1000 ? 1000 : result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loads != null)
|
||||||
|
{
|
||||||
|
//麻痹状态增加冷却时间
|
||||||
|
var atkCoolData = loads.Find(it => it.code == nameof(GameEnum.AttrCode.PalsyAtk));
|
||||||
|
if (atkCoolData != null)
|
||||||
|
{
|
||||||
|
result = Convert.ToInt32(result * (1 + atkCoolData.count * 0.1M));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 战斗预计时间
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="atkUser"></param>
|
||||||
|
/// <param name="defUser"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static long GetFightDueTime(UserAttrModel atkUser, UserAttrModel defUser)
|
||||||
|
{
|
||||||
|
long result = 3 * 60 * 60 * 1000;
|
||||||
|
if (atkUser.minAtk > defUser.defense && defUser.defense > 0)
|
||||||
|
{
|
||||||
|
decimal harmRide = (atkUser.minAtk - defUser.defense) / defUser.defense;
|
||||||
|
harmRide = harmRide > 1.2M ? 1.2M : harmRide;
|
||||||
|
decimal fight_Harm = harmRide * atkUser.maxAtk;
|
||||||
|
if (fight_Harm >= defUser.blood)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int cool = GetFightCool(atkUser.agility, defUser.agility);
|
||||||
|
int count = Convert.ToInt32(defUser.blood / fight_Harm);
|
||||||
|
result = count * cool;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -74,6 +74,11 @@ public static class GameBus
|
|||||||
var skillService = App.GetService<IGameSkillService>();
|
var skillService = App.GetService<IGameSkillService>();
|
||||||
isok = await skillService.UpdateUserSkill(userId, Convert.ToInt32(parameter));
|
isok = await skillService.UpdateUserSkill(userId, Convert.ToInt32(parameter));
|
||||||
}
|
}
|
||||||
|
else if (goodsType.Equals(nameof(GameEnum.PropCode.maxName)))
|
||||||
|
{
|
||||||
|
var maxNameService = App.GetService<IGameMaxNameService>();
|
||||||
|
isok = await maxNameService.AddMaxName(userId, parameter, Convert.ToInt32(count));
|
||||||
|
}
|
||||||
|
|
||||||
return isok;
|
return isok;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace Application.Domain;
|
|||||||
|
|
||||||
public class GameTool
|
public class GameTool
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 单位转换
|
/// 单位转换
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace Application.Service.Pub;
|
using Photon.Core.Assist;
|
||||||
|
|
||||||
|
namespace Application.Service.Pub;
|
||||||
|
|
||||||
public class TimeExtend
|
public class TimeExtend
|
||||||
{
|
{
|
||||||
@@ -21,4 +23,28 @@ public class TimeExtend
|
|||||||
{
|
{
|
||||||
return Convert.ToInt64((time - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalMilliseconds);
|
return Convert.ToInt64((time - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalMilliseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static long GetTimeStampSecondsByCode(string code, DateTime maxTime)
|
||||||
|
{
|
||||||
|
long result = 0;
|
||||||
|
switch (code)
|
||||||
|
{
|
||||||
|
case "Long":
|
||||||
|
result = GetTimeStampBySeconds(maxTime);
|
||||||
|
break;
|
||||||
|
case "Day":
|
||||||
|
result = GetTimeStampBySeconds(TimeAssist.GetDateTimeYMD(1));
|
||||||
|
break;
|
||||||
|
case "Month":
|
||||||
|
DateTime nt = DateTime.Now.AddMonths(1);
|
||||||
|
nt = Convert.ToDateTime($"{nt.Year}-{nt.Month}-01");
|
||||||
|
result = GetTimeStampBySeconds(nt);
|
||||||
|
break;
|
||||||
|
case "Week":
|
||||||
|
result = GetTimeStampBySeconds(TimeAssist.WeekEndTime);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,9 @@
|
|||||||
<Content Update="applicationsettings.json">
|
<Content Update="applicationsettings.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Update="applicationsettings.txt">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using Photon.Core.Timer;
|
using Jaina;
|
||||||
|
using Photon.Core.Redis;
|
||||||
|
using Photon.Core.Timer;
|
||||||
|
|
||||||
namespace Application.Domain;
|
namespace Application.Web;
|
||||||
|
|
||||||
public class GameAutoJobService(ISqlSugarClient DbClient, IRedisCache redis, ITimerJobManager jobManager)
|
public class GameAutoJobService(ISqlSugarClient DbClient, IRedisCache redis, ITimerJobManager jobManager)
|
||||||
: IGameAutoJobService, ITransient
|
: IGameAutoJobService, ITransient
|
||||||
@@ -103,5 +105,23 @@ public class GameAutoJobService(ISqlSugarClient DbClient, IRedisCache redis, ITi
|
|||||||
await _eventPublisher.PublishAsync(new ChannelEventSource(BusEventsEnum.BusEventsName.HandelTaskUser,
|
await _eventPublisher.PublishAsync(new ChannelEventSource(BusEventsEnum.BusEventsName.HandelTaskUser,
|
||||||
data));
|
data));
|
||||||
}
|
}
|
||||||
|
else if (data.code == nameof(GameEnum.JobCode.ClearChat)) //清理频道信息
|
||||||
|
{
|
||||||
|
var _eventPublisher = App.GetService<IEventPublisher>();
|
||||||
|
await _eventPublisher.PublishAsync(new ChannelEventSource(BusEventsEnum.BusEventsName.HandleClearChat,
|
||||||
|
data));
|
||||||
|
}
|
||||||
|
else if (data.code == nameof(GameEnum.JobCode.ClearMessage)) //清理频道信息
|
||||||
|
{
|
||||||
|
var _eventPublisher = App.GetService<IEventPublisher>();
|
||||||
|
await _eventPublisher.PublishAsync(new ChannelEventSource(BusEventsEnum.BusEventsName.HandleMessageData,
|
||||||
|
data));
|
||||||
|
}
|
||||||
|
else if (data.code == nameof(GameEnum.JobCode.UpdateMagicData)) //处理魔城数据
|
||||||
|
{
|
||||||
|
var _eventPublisher = App.GetService<IEventPublisher>();
|
||||||
|
await _eventPublisher.PublishAsync(new ChannelEventSource(BusEventsEnum.BusEventsName.HandleMagicData,
|
||||||
|
data));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Application.Domain;
|
namespace Application.Web;
|
||||||
|
|
||||||
public interface IGameAutoJobService
|
public interface IGameAutoJobService
|
||||||
{
|
{
|
||||||
@@ -98,7 +98,7 @@ public class ChatController : ControllerBase
|
|||||||
isSend = par != "0";
|
isSend = par != "0";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
isSend = true;
|
isSend = false;
|
||||||
code = nameof(GameChatEnum.Code.Group);
|
code = nameof(GameChatEnum.Code.Group);
|
||||||
par = "";
|
par = "";
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -49,6 +49,16 @@ namespace Application.Web.Controllers.Login
|
|||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<string> HandleError()
|
||||||
|
{
|
||||||
|
var magicService = App.GetService<IGameMagicService>();
|
||||||
|
await magicService.HandleMagicData();
|
||||||
|
|
||||||
|
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 登录接口
|
/// 登录接口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -11,10 +11,13 @@ public class MapBusController : ControllerBase
|
|||||||
{
|
{
|
||||||
private readonly IGameMapService _mapService;
|
private readonly IGameMapService _mapService;
|
||||||
private readonly IMessageService _messageService;
|
private readonly IMessageService _messageService;
|
||||||
public MapBusController(IGameMapService mapService,IMessageService messageService)
|
private readonly IGameMagicService _magicService;
|
||||||
|
|
||||||
|
public MapBusController(IGameMapService mapService, IMessageService messageService, IGameMagicService magicService)
|
||||||
{
|
{
|
||||||
_mapService = mapService;
|
_mapService = mapService;
|
||||||
_messageService = messageService;
|
_messageService = messageService;
|
||||||
|
_magicService = magicService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -52,6 +55,7 @@ public class MapBusController : ControllerBase
|
|||||||
public async Task<IPoAction> MapBusTo(int id, int num)
|
public async Task<IPoAction> MapBusTo(int id, int num)
|
||||||
{
|
{
|
||||||
string userId = StateHelper.userId;
|
string userId = StateHelper.userId;
|
||||||
|
int areaId = StateHelper.areaId;
|
||||||
var busData = await _mapService.GetMapBusInfo(id);
|
var busData = await _mapService.GetMapBusInfo(id);
|
||||||
if (busData == null)
|
if (busData == null)
|
||||||
{
|
{
|
||||||
@@ -63,39 +67,59 @@ public class MapBusController : ControllerBase
|
|||||||
return PoAction.Message("业务不存在!");
|
return PoAction.Message("业务不存在!");
|
||||||
}
|
}
|
||||||
|
|
||||||
var toData = JsonConvert.DeserializeObject<List<MapBusTo> >(busData.busContent);
|
var toData = JsonConvert.DeserializeObject<List<MapBusTo>>(busData.busContent);
|
||||||
if (num > (toData.Count - 1))
|
if (num > (toData.Count - 1))
|
||||||
{
|
{
|
||||||
return PoAction.Message("业务不存在!");
|
return PoAction.Message("业务不存在!");
|
||||||
}
|
}
|
||||||
|
|
||||||
var onMap = await _mapService.GetUserOnMapId(userId);
|
var onMap = await _mapService.GetUserOnMapId(userId);
|
||||||
if (busData.busCode != onMap)
|
if (busData.busCode != onMap)
|
||||||
{
|
{
|
||||||
return PoAction.Message("业务不存在!");
|
return PoAction.Message("业务不存在!");
|
||||||
}
|
}
|
||||||
|
|
||||||
var mapToData = toData[num];
|
var mapToData = toData[num];
|
||||||
if (TimeAssist.GetHourNum < mapToData.sTime || TimeAssist.GetHourNum > mapToData.eTime)
|
if (TimeAssist.GetHourNum < mapToData.sTime || TimeAssist.GetHourNum > mapToData.eTime)
|
||||||
{
|
{
|
||||||
return PoAction.Message($"当前时间不允许进入");
|
return PoAction.Message($"当前时间不允许进入");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region 验证机制
|
||||||
|
|
||||||
|
if (mapToData.code == nameof(MapEnum.MapCode.Magic_Map)) //魔城场景,验证否否进入过
|
||||||
|
{
|
||||||
|
if (await _magicService.CheckInMagic(userId) == false)
|
||||||
|
{
|
||||||
|
return PoAction.Message($"您的魔城记录冷却中,冷却时间为7天!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
var checkResult = await GameBus.CheckNeed(userId, busData.busNeed, 1);
|
var checkResult = await GameBus.CheckNeed(userId, busData.busNeed, 1);
|
||||||
if (checkResult.result==false)
|
if (checkResult.result == false)
|
||||||
{
|
{
|
||||||
return PoAction.Message("不满足传送要求!");
|
return PoAction.Message("不满足传送要求!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (await GameBus.UpdateBag(userId, 0, busData.busNeed, "业务传送"))
|
if (await GameBus.UpdateBag(userId, 0, busData.busNeed, "业务传送"))
|
||||||
{
|
{
|
||||||
var ResultMap = await _mapService.GetToMapInfo(userId, mapToData.mapId, true, true);
|
var ResultMap = await _mapService.GetToMapInfo(userId, mapToData.mapId, true, true);
|
||||||
if (ResultMap != null)
|
if (ResultMap != null)
|
||||||
{
|
{
|
||||||
|
if (mapToData.code == nameof(MapEnum.MapCode.Magic_Map)) //魔城场景
|
||||||
|
{
|
||||||
|
await _magicService.UpdateUserMagicTime(userId,areaId);
|
||||||
|
}
|
||||||
|
|
||||||
return PoAction.Ok(true);
|
return PoAction.Ok(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return PoAction.Message("操作失败,请稍后尝试!");
|
return PoAction.Message("操作失败,请稍后尝试!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -103,7 +127,7 @@ public class MapBusController : ControllerBase
|
|||||||
return PoAction.Message("操作失败,请稍后尝试!");
|
return PoAction.Message("操作失败,请稍后尝试!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 打开宝箱
|
/// 打开宝箱
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -129,13 +153,13 @@ public class MapBusController : ControllerBase
|
|||||||
{
|
{
|
||||||
return PoAction.Message("业务不存在!");
|
return PoAction.Message("业务不存在!");
|
||||||
}
|
}
|
||||||
|
|
||||||
var checkResult = await GameBus.CheckNeed(userId, busData.busNeed, 1);
|
var checkResult = await GameBus.CheckNeed(userId, busData.busNeed, 1);
|
||||||
if (checkResult.result==false)
|
if (checkResult.result == false)
|
||||||
{
|
{
|
||||||
return PoAction.Message("不满足开启要求!");
|
return PoAction.Message("不满足开启要求!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (await GameBus.UpdateBag(userId, 0, busData.busNeed, "业务传送"))
|
if (await GameBus.UpdateBag(userId, 0, busData.busNeed, "业务传送"))
|
||||||
{
|
{
|
||||||
string message = "";
|
string message = "";
|
||||||
@@ -158,7 +182,8 @@ public class MapBusController : ControllerBase
|
|||||||
{
|
{
|
||||||
message = "空空如也,什么也没有得到!";
|
message = "空空如也,什么也没有得到!";
|
||||||
}
|
}
|
||||||
return PoAction.Ok(true,message);
|
|
||||||
|
return PoAction.Ok(true, message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Application.Web.Controllers.Map;
|
namespace Application.Web.Controllers.Map;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -24,12 +25,13 @@ public class MapController : ControllerBase
|
|||||||
private readonly IGameFightService _fightService;
|
private readonly IGameFightService _fightService;
|
||||||
private readonly IOnHookService _hookService;
|
private readonly IOnHookService _hookService;
|
||||||
private readonly IGameTaskService _taskService;
|
private readonly IGameTaskService _taskService;
|
||||||
|
private readonly INoticeService _noticeService;
|
||||||
|
|
||||||
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,
|
IUnitUserAccService accService, IGameSkillService skillService, IGameGoodsService goodsService,
|
||||||
IGameTeamService teamService, IGameMonsterService monsterService, IGameFightService fightService,
|
IGameTeamService teamService, IGameMonsterService monsterService, IGameFightService fightService,
|
||||||
IOnHookService hookService, IGameTaskService taskService)
|
IOnHookService hookService, IGameTaskService taskService, INoticeService noticeService)
|
||||||
{
|
{
|
||||||
_userService = userService;
|
_userService = userService;
|
||||||
_mapService = mapService;
|
_mapService = mapService;
|
||||||
@@ -45,6 +47,7 @@ public class MapController : ControllerBase
|
|||||||
_fightService = fightService;
|
_fightService = fightService;
|
||||||
_hookService = hookService;
|
_hookService = hookService;
|
||||||
_taskService = taskService;
|
_taskService = taskService;
|
||||||
|
_noticeService = noticeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 地图相关
|
#region 地图相关
|
||||||
@@ -125,38 +128,30 @@ public class MapController : ControllerBase
|
|||||||
string ip = ComHelper.GetClientUserIp(HttpContext);
|
string ip = ComHelper.GetClientUserIp(HttpContext);
|
||||||
await _mapService.UpdateUserOnMap(userId, ip, mapInfo.mapId);
|
await _mapService.UpdateUserOnMap(userId, ip, mapInfo.mapId);
|
||||||
|
|
||||||
//地图业务
|
|
||||||
IEnumerable<object> business = new List<object>();
|
|
||||||
if (mapInfo.isBus == 1)
|
|
||||||
{
|
|
||||||
var busData = await _mapService.GetMapBus(mapInfo.mapId, 0, 0);
|
|
||||||
business = busData.Select(it => new
|
|
||||||
{
|
|
||||||
busId = it.busId,
|
|
||||||
busName = it.busName
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//地图资源
|
|
||||||
List<MapResModel> mapRes = new List<MapResModel>();
|
|
||||||
if (mapInfo.isRes == 1)
|
|
||||||
{
|
|
||||||
mapRes = await _mapService.GetMapResData(mapInfo.mapId, area);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
var busData = await _mapService.GetMapBus(mapInfo.mapId, 0, 0); //地图业务
|
||||||
|
IEnumerable<object> business = busData.Select(it => new
|
||||||
|
{
|
||||||
|
busId = it.busId,
|
||||||
|
busName = it.busName
|
||||||
|
});
|
||||||
|
|
||||||
|
List<MapResModel> mapRes = await _mapService.GetMapResData(mapInfo.mapId, area); //地图资源
|
||||||
var broadcast = await _messageService.GetBroadcastData(area);
|
var broadcast = await _messageService.GetBroadcastData(area);
|
||||||
|
|
||||||
var userFight = await _fightService.GetUserFight(userId);
|
var userFight = await _fightService.GetUserFight(userId);
|
||||||
string fightId = userFight.Count > 0 ? userFight[0] : "";
|
string fightId = userFight.Count > 0 ? userFight[0] : "";
|
||||||
var mapGoods = await _fightService.GetMapFightGoods(mapInfo.mapId);
|
var mapGoods = await _fightService.GetMapFightGoods(mapInfo.mapId);
|
||||||
mapGoods = mapGoods.FindAll(it => it.userId == "0" || it.userId == userId).Take(3).ToList();
|
mapGoods = mapGoods.FindAll(it => it.userId == "0" || it.userId == userId).Take(3).ToList();
|
||||||
var taskData = await _taskService.GetUserTaskData(userId);
|
var taskData = await _taskService.GetUserTaskData(userId);
|
||||||
int isHook = 0; //挂机处理
|
int isHook = 0; //挂机处理
|
||||||
var onHook = await _hookService.GetUserOnHook(userId);
|
var onHook = await _hookService.GetUserOnHook(userId);
|
||||||
isHook = (int)onHook.status;
|
isHook = (int)onHook.status;
|
||||||
|
|
||||||
|
var notice = await _noticeService.GetNoticeDataByMap();
|
||||||
|
|
||||||
object ret = new
|
object ret = new
|
||||||
{
|
{
|
||||||
mapInfo,
|
mapInfo,
|
||||||
@@ -174,6 +169,7 @@ public class MapController : ControllerBase
|
|||||||
fightId,
|
fightId,
|
||||||
gameTips,
|
gameTips,
|
||||||
isHook,
|
isHook,
|
||||||
|
notice,
|
||||||
taskCount = taskData.Count
|
taskCount = taskData.Count
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -220,6 +216,7 @@ public class MapController : ControllerBase
|
|||||||
var onMap = await _mapService.GetUserOnMap(userId);
|
var onMap = await _mapService.GetUserOnMap(userId);
|
||||||
var mapInfo = await _mapService.GetMapInfo(onMap.mapId);
|
var mapInfo = await _mapService.GetMapInfo(onMap.mapId);
|
||||||
var data = await _mapService.GetCityMap((int)mapInfo.cityId);
|
var data = await _mapService.GetCityMap((int)mapInfo.cityId);
|
||||||
|
data = data.FindAll(it => it.code == nameof(MapEnum.MapCode.DEF_MAP));
|
||||||
if (!string.IsNullOrEmpty(search))
|
if (!string.IsNullOrEmpty(search))
|
||||||
{
|
{
|
||||||
data = data.FindAll(it => it.mapName.Contains(search));
|
data = data.FindAll(it => it.mapName.Contains(search));
|
||||||
@@ -365,6 +362,12 @@ public class MapController : ControllerBase
|
|||||||
return PoAction.Message("城市不存在!");
|
return PoAction.Message("城市不存在!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lev = await _attrService.GetUserLev(userId);
|
||||||
|
if (lev < 31)
|
||||||
|
{
|
||||||
|
return PoAction.Message("等级达到31级才可以传送哦!");
|
||||||
|
}
|
||||||
|
|
||||||
var userWeight = await _weightService.GetUserWeightInfo(userId);
|
var userWeight = await _weightService.GetUserWeightInfo(userId);
|
||||||
if (userWeight.shipOnWeight > 0)
|
if (userWeight.shipOnWeight > 0)
|
||||||
{
|
{
|
||||||
@@ -467,7 +470,12 @@ public class MapController : ControllerBase
|
|||||||
{
|
{
|
||||||
return PoAction.Message("城市不存在!");
|
return PoAction.Message("城市不存在!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lev = await _attrService.GetUserLev(userId);
|
||||||
|
if (lev < 31)
|
||||||
|
{
|
||||||
|
return PoAction.Message("等级达到31级才可以出海哦!");
|
||||||
|
}
|
||||||
|
|
||||||
var onMapInfo = await _mapService.GetMapInfo(onMap.mapId);
|
var onMapInfo = await _mapService.GetMapInfo(onMap.mapId);
|
||||||
if (onMapInfo.cityId == cityId)
|
if (onMapInfo.cityId == cityId)
|
||||||
@@ -678,6 +686,69 @@ public class MapController : ControllerBase
|
|||||||
return PoAction.Ok(new { data, task });
|
return PoAction.Ok(new { data, task });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 处理Npc事务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="npcId"></param>
|
||||||
|
/// <param name="code"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IPoAction> HandleNpcEvent(int npcId, string code, string? parms)
|
||||||
|
{
|
||||||
|
string userId = StateHelper.userId;
|
||||||
|
int areaId = StateHelper.areaId;
|
||||||
|
var data = await _mapService.GetNpcInfo(npcId);
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
return PoAction.Message("Npc不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.status != 1)
|
||||||
|
{
|
||||||
|
return PoAction.Message("Npc不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.code != nameof(MapEnum.NpcCode.Event))
|
||||||
|
{
|
||||||
|
return PoAction.Message("无法处理该业务!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.bus.Any(it => it.code == code) == false)
|
||||||
|
{
|
||||||
|
return PoAction.Message("无法处理该业务!");
|
||||||
|
}
|
||||||
|
|
||||||
|
var onMap = await _mapService.GetUserOnMap(userId);
|
||||||
|
if (data.mapId != onMap.mapId)
|
||||||
|
{
|
||||||
|
return PoAction.Message("Npc不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code == nameof(MapEnum.NpcEventCode.Magic_Event)) //魔城
|
||||||
|
{
|
||||||
|
var magicService = App.GetService<IGameMagicService>();
|
||||||
|
bool isWin = false;
|
||||||
|
if (TimeAssist.GetHourNum > 221000)
|
||||||
|
{
|
||||||
|
var onMapUser = await _mapService.GetMapUser(GameConfig.GameMagicMapId, areaId, 1, [userId], 1);
|
||||||
|
if (onMapUser.Count == 0)
|
||||||
|
{
|
||||||
|
string time = TimeAssist.GetDateTimeYMDString(0);
|
||||||
|
if (await magicService.IsHaveWin(areaId, time)==false)
|
||||||
|
{
|
||||||
|
isWin = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await magicService.UpdateUserMagicEndTime(userId, isWin);
|
||||||
|
|
||||||
|
await _mapService.UpdateUserOnMap(onMap, GameConfig.GameMagicInMapId); //设置地图
|
||||||
|
return PoAction.Ok(0, "魔城成功退出!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return PoAction.Message("非处理的游戏项!");
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 采集相关
|
#region 采集相关
|
||||||
@@ -710,7 +781,7 @@ public class MapController : ControllerBase
|
|||||||
return PoAction.Message($"{lockTime}秒后可采集!");
|
return PoAction.Message($"{lockTime}秒后可采集!");
|
||||||
}
|
}
|
||||||
|
|
||||||
var skillInfo = await _skillService.GetUserSkillInfo(userId, nameof(SkillEnum.code.Collect));
|
var skillInfo = await _skillService.GetUserSkillInfo(userId, nameof(SkillEnum.code.GATHER));
|
||||||
if (skillInfo == null)
|
if (skillInfo == null)
|
||||||
{
|
{
|
||||||
return PoAction.Message("未学习采集术!");
|
return PoAction.Message("未学习采集术!");
|
||||||
|
|||||||
@@ -100,7 +100,10 @@ public class TaskController : ControllerBase
|
|||||||
int toGoods = await _goodsService.GetUserGoodsCount(userId, GameConfig.GameGetTaskGoods);
|
int toGoods = await _goodsService.GetUserGoodsCount(userId, GameConfig.GameGetTaskGoods);
|
||||||
int retGoods = await _goodsService.GetUserGoodsCount(userId, GameConfig.GameRetTaskGoods);
|
int retGoods = await _goodsService.GetUserGoodsCount(userId, GameConfig.GameRetTaskGoods);
|
||||||
return PoAction.Ok(new
|
return PoAction.Ok(new
|
||||||
{ npc = npcInfo, data = data, talkMsg, taskState, btnTips = taskInfo.btnTips, toGoods, retGoods });
|
{
|
||||||
|
npc = npcInfo, data = data, talkMsg, taskState, award = taskInfo.award, btnTips = taskInfo.btnTips, toGoods,
|
||||||
|
retGoods
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -124,7 +127,7 @@ public class TaskController : ControllerBase
|
|||||||
public async Task<IPoAction> RestTask(int task)
|
public async Task<IPoAction> RestTask(int task)
|
||||||
{
|
{
|
||||||
string userId = StateHelper.userId;
|
string userId = StateHelper.userId;
|
||||||
var onTaskInfo = await _taskService.GetUserTaskInfo(userId,task);
|
var onTaskInfo = await _taskService.GetUserTaskInfo(userId, task);
|
||||||
if (onTaskInfo == null)
|
if (onTaskInfo == null)
|
||||||
{
|
{
|
||||||
return PoAction.Message("暂无任务!");
|
return PoAction.Message("暂无任务!");
|
||||||
@@ -188,7 +191,7 @@ public class TaskController : ControllerBase
|
|||||||
int toGoods = await _goodsService.GetUserGoodsCount(userId, GameConfig.GameGetTaskGoods);
|
int toGoods = await _goodsService.GetUserGoodsCount(userId, GameConfig.GameGetTaskGoods);
|
||||||
int retGoods = await _goodsService.GetUserGoodsCount(userId, GameConfig.GameRetTaskGoods);
|
int retGoods = await _goodsService.GetUserGoodsCount(userId, GameConfig.GameRetTaskGoods);
|
||||||
return PoAction.Ok(new
|
return PoAction.Ok(new
|
||||||
{ data = data, talkMsg, taskState, toGoods, retGoods,lev = taskInfo.lev });
|
{ data = data, talkMsg, taskState, toGoods, retGoods, lev = taskInfo.lev, award = taskInfo.award });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -263,7 +266,7 @@ public class TaskController : ControllerBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
message = message.TrimEnd(',');
|
message = message.TrimEnd(',');
|
||||||
await GameBus.UpdateBag(userId, 1, award, "完成任务");//发放奖励
|
await GameBus.UpdateBag(userId, 1, award, "完成任务"); //发放奖励
|
||||||
}
|
}
|
||||||
|
|
||||||
return PoAction.Ok(true, message);
|
return PoAction.Ok(true, message);
|
||||||
|
|||||||
88
Service/Application.Web/Controllers/Pub/CdkController.cs
Normal file
88
Service/Application.Web/Controllers/Pub/CdkController.cs
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Application.Web.Controllers.Pub;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cdk接口
|
||||||
|
/// </summary>
|
||||||
|
[Route("[controller]/[action]")]
|
||||||
|
[ApiController]
|
||||||
|
[Authorize]
|
||||||
|
public class CdkController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IGameCdkService _cdkService;
|
||||||
|
public CdkController(IGameCdkService cdkService)
|
||||||
|
{
|
||||||
|
_cdkService = cdkService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 兑换CDK
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cdk"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IPoAction> Exchange(string cdk)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(cdk))
|
||||||
|
{
|
||||||
|
return PoAction.Message("CDK不能为空!");
|
||||||
|
}
|
||||||
|
var cdkItem = await _cdkService.GetCdkItemInfo(cdk);
|
||||||
|
if (cdkItem == null)
|
||||||
|
{
|
||||||
|
return PoAction.Message("CDK无效!");
|
||||||
|
}
|
||||||
|
if (cdkItem.userId != "0")
|
||||||
|
{
|
||||||
|
return PoAction.Message("CDK已被使用!");
|
||||||
|
}
|
||||||
|
var cdkInfo = await _cdkService.GetCdkInfo((int)cdkItem.cdkId);
|
||||||
|
if (cdkInfo == null)
|
||||||
|
{
|
||||||
|
return PoAction.Message("CDK无效!");
|
||||||
|
}
|
||||||
|
if (cdkInfo.endTime < DateTime.Now)
|
||||||
|
{
|
||||||
|
return PoAction.Message("CDK已过期!");
|
||||||
|
}
|
||||||
|
if (cdkInfo.area != 0)
|
||||||
|
{
|
||||||
|
if (cdkInfo.area != StateHelper.areaId)
|
||||||
|
{
|
||||||
|
return PoAction.Message($"该CDK仅可在{cdkInfo.area}区使用!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string userId = StateHelper.userId;
|
||||||
|
if (cdkInfo.limit > 0)
|
||||||
|
{
|
||||||
|
int onCount = await _cdkService.GetUserCdkCount(cdkInfo.cdkId, userId);
|
||||||
|
if (onCount >= cdkInfo.limit)
|
||||||
|
{
|
||||||
|
return PoAction.Message($"该类型CDK限制兑换{cdkInfo.limit}个!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (await _cdkService.UpdateCdkUser(cdk, userId))
|
||||||
|
{
|
||||||
|
if (await GameBus.UpdateBag(userId, 1, cdkInfo.award, "CDK获得"))
|
||||||
|
{
|
||||||
|
string message = "兑换成功,获得:";
|
||||||
|
foreach (var item in cdkInfo.award)
|
||||||
|
{
|
||||||
|
message += $"{item.name}+{item.count},";
|
||||||
|
}
|
||||||
|
message = message.TrimEnd(',');
|
||||||
|
return PoAction.Ok(true,message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PoAction.Message("兑换失败,请稍后尝试!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PoAction.Message("兑换失败,请稍后尝试!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -127,24 +127,7 @@ public class ExchangeController : ControllerBase
|
|||||||
{
|
{
|
||||||
if (await GameBus.UpdateBag(userId, 0, exInfo.needData, "兑换", count))
|
if (await GameBus.UpdateBag(userId, 0, exInfo.needData, "兑换", count))
|
||||||
{
|
{
|
||||||
long endTime = 0;
|
long endTime = TimeExtend.GetTimeStampSecondsByCode(exInfo.exType, (DateTime)exInfo.endTime);
|
||||||
switch (exInfo.exType)
|
|
||||||
{
|
|
||||||
case "Long":
|
|
||||||
endTime = TimeExtend.GetTimeStampBySeconds((DateTime)exInfo.endTime);
|
|
||||||
break;
|
|
||||||
case "Day":
|
|
||||||
endTime = TimeExtend.GetTimeStampBySeconds(TimeAssist.GetDateTimeYMD(1));
|
|
||||||
break;
|
|
||||||
case "Month":
|
|
||||||
DateTime nt = DateTime.Now.AddMonths(1);
|
|
||||||
nt = Convert.ToDateTime($"{nt.Year}-{nt.Month}-01");
|
|
||||||
endTime = TimeExtend.GetTimeStampBySeconds(nt);
|
|
||||||
break;
|
|
||||||
case "Week":
|
|
||||||
endTime = TimeExtend.GetTimeStampBySeconds(TimeAssist.WeekEndTime);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (await _exchangeService.AddUserExchangeLog(userId, exId, count, endTime))
|
if (await _exchangeService.AddUserExchangeLog(userId, exId, count, endTime))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -83,10 +83,10 @@ public class FightController : ControllerBase
|
|||||||
pars = JsonConvert.SerializeObject(new { type = "Create", code = monster.code, par = monster.par });
|
pars = JsonConvert.SerializeObject(new { type = "Create", code = monster.code, par = monster.par });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var userAttr = await _attrService.GetUserAttrModel(userId, scene);
|
||||||
var monsterInfo = await _monsterService.GetMonsterInfo(mainId);
|
var monsterInfo = await _monsterService.GetMonsterInfo(mainId);
|
||||||
if (monsterInfo != null)
|
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));
|
copper = Convert.ToInt64(monsterInfo.copper * (1.0m + userAttr.addGold));
|
||||||
@@ -102,7 +102,10 @@ public class FightController : ControllerBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result = await _fightService.AddFight(fightId, areaCode, keyId, mainId, code, scene, mapId, userId, exp,
|
var otAttr = await _monsterService.GetMonsterAttrModel(keyId, mainId);
|
||||||
|
long dueTime = FightTool.GetFightDueTime(userAttr, otAttr);
|
||||||
|
bool result = await _fightService.AddFight(fightId, areaCode, keyId, mainId, code, scene, mapId, userId,
|
||||||
|
dueTime, exp,
|
||||||
copper, petExp, award, pars);
|
copper, petExp, award, pars);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
@@ -174,8 +177,11 @@ public class FightController : ControllerBase
|
|||||||
long petExp = 0;
|
long petExp = 0;
|
||||||
string award = string.Empty;
|
string award = string.Empty;
|
||||||
string pars = "";
|
string pars = "";
|
||||||
|
var userAttr = await _attrService.GetUserAttrModel(userId);
|
||||||
|
var otAttr = await _attrService.GetUserAttrModel(otUser.userId);
|
||||||
|
long dueTime = FightTool.GetFightDueTime(userAttr, otAttr);
|
||||||
bool result = await _fightService.AddFight(fightId, areaCode, keyId, otUser.userId, code, onMapInfo.code,
|
bool result = await _fightService.AddFight(fightId, areaCode, keyId, otUser.userId, code, onMapInfo.code,
|
||||||
onMapInfo.mapId, userId, exp,
|
onMapInfo.mapId, userId, dueTime, exp,
|
||||||
copper, petExp, award, pars);
|
copper, petExp, award, pars);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
@@ -257,9 +263,10 @@ public class FightController : ControllerBase
|
|||||||
|
|
||||||
otAttr = await _attrService.GetUserAttrModel(fight.mainId, fight.scene);
|
otAttr = await _attrService.GetUserAttrModel(fight.mainId, fight.scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fightResult.result == 0)
|
if (fightResult.result == 0)
|
||||||
{
|
{
|
||||||
if (otAttr.blood >0)
|
if (otAttr.blood > 0)
|
||||||
{
|
{
|
||||||
myHarm = fightResult.myHarm;
|
myHarm = fightResult.myHarm;
|
||||||
myHarm += await _fightService.GetUserFightHarm(userId);
|
myHarm += await _fightService.GetUserFightHarm(userId);
|
||||||
@@ -306,22 +313,8 @@ public class FightController : ControllerBase
|
|||||||
var myLoad = await _attrService.GetUserLoadState(userId);
|
var myLoad = await _attrService.GetUserLoadState(userId);
|
||||||
|
|
||||||
//冷却时间
|
//冷却时间
|
||||||
int cool = 1000;
|
int cool = FightTool.GetFightCool(myAttr.agility, otAttr.agility);
|
||||||
if (myAttr.agility > otAttr.agility && otAttr.agility > 0)
|
|
||||||
{
|
|
||||||
decimal diff = myAttr.agility - otAttr.agility;
|
|
||||||
decimal bl = diff / otAttr.agility;
|
|
||||||
cool = Convert.ToInt32((1 - bl) * 1000.0m);
|
|
||||||
cool = cool < 10 ? 10 : cool;
|
|
||||||
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; //退出战斗需要的铜贝
|
int exitCopper = otAttr.lev * 5; //退出战斗需要的铜贝
|
||||||
var result = new
|
var result = new
|
||||||
@@ -556,16 +549,19 @@ public class FightController : ControllerBase
|
|||||||
var myAttr = await _attrService.GetUserAttrModel(userId, fight.scene);
|
var myAttr = await _attrService.GetUserAttrModel(userId, fight.scene);
|
||||||
var parsData = JsonConvert.DeserializeObject<dynamic>(fight.pars);
|
var parsData = JsonConvert.DeserializeObject<dynamic>(fight.pars);
|
||||||
object figResult = new object();
|
object figResult = new object();
|
||||||
if (Convert.ToString(parsData.type) == "Create")
|
if (fight.code == nameof(GameEnum.FightCode.PVE))
|
||||||
{
|
{
|
||||||
if (Convert.ToString(parsData.code) == nameof(MonsterEnum.MonsterCode.Task))
|
if (Convert.ToString(parsData.type) == "Create")
|
||||||
{
|
{
|
||||||
int itemId = Convert.ToInt32(parsData.par);
|
if (Convert.ToString(parsData.code) == nameof(MonsterEnum.MonsterCode.Task))
|
||||||
var taskInfo = await _taskService.GetTaskItemInfo(itemId);
|
|
||||||
if (taskInfo != null)
|
|
||||||
{
|
{
|
||||||
figArea = nameof(MonsterEnum.MonsterCode.Task);
|
int itemId = Convert.ToInt32(parsData.par);
|
||||||
figResult = await _taskService.GetUserTaskModel(userId, taskInfo);
|
var taskInfo = await _taskService.GetTaskItemInfo(itemId);
|
||||||
|
if (taskInfo != null)
|
||||||
|
{
|
||||||
|
figArea = nameof(MonsterEnum.MonsterCode.Task);
|
||||||
|
figResult = await _taskService.GetUserTaskModel(userId, taskInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -635,8 +631,14 @@ public class FightController : ControllerBase
|
|||||||
return PoAction.Message("该战斗不可复刻挂机!");
|
return PoAction.Message("该战斗不可复刻挂机!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (await _fightService.ValidFight(fight,false) == false)
|
||||||
|
{
|
||||||
|
return PoAction.Message("异常的战斗,无法挂机!");
|
||||||
|
}
|
||||||
|
|
||||||
var myAttr = await _attrService.GetUserAttrModel(userId, fight.scene);
|
var myAttr = await _attrService.GetUserAttrModel(userId, fight.scene);
|
||||||
int diffTime = Convert.ToInt32(fight.okTime - fight.addTime);
|
int diffTime = Convert.ToInt32(fight.okTime - fight.addTime);
|
||||||
|
diffTime = diffTime < 300 ? 300 : diffTime;
|
||||||
decimal score = myAttr.score * 0.7M;
|
decimal score = myAttr.score * 0.7M;
|
||||||
bool result = await _hookService.StartOnHook(userId, fight.scene, (long)monster.copper, (long)monster.exp,
|
bool result = await _hookService.StartOnHook(userId, fight.scene, (long)monster.copper, (long)monster.exp,
|
||||||
monster.name,
|
monster.name,
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ public class RecoverController : ControllerBase
|
|||||||
private readonly IUnitUserAccService _accService;
|
private readonly IUnitUserAccService _accService;
|
||||||
private readonly IGameEquService _equService;
|
private readonly IGameEquService _equService;
|
||||||
|
|
||||||
public RecoverController(IUnitUserAttrService attrService, IGameMapService mapService,IUnitUserAccService accService,IGameEquService equService)
|
public RecoverController(IUnitUserAttrService attrService, IGameMapService mapService,
|
||||||
|
IUnitUserAccService accService, IGameEquService equService)
|
||||||
{
|
{
|
||||||
_attrService = attrService;
|
_attrService = attrService;
|
||||||
_mapService = mapService;
|
_mapService = mapService;
|
||||||
@@ -144,7 +145,8 @@ public class RecoverController : ControllerBase
|
|||||||
{
|
{
|
||||||
string userId = StateHelper.userId;
|
string userId = StateHelper.userId;
|
||||||
var data = await _attrService.GetUserVigourInfo(userId);
|
var data = await _attrService.GetUserVigourInfo(userId);
|
||||||
return PoAction.Ok(data);
|
long maxVigour = await _attrService.GetUserMaxVitality(userId);
|
||||||
|
return PoAction.Ok(new { data, maxVigour });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -189,12 +191,14 @@ public class RecoverController : ControllerBase
|
|||||||
{
|
{
|
||||||
return PoAction.Message("今天已恢复过活力啦!");
|
return PoAction.Message("今天已恢复过活力啦!");
|
||||||
}
|
}
|
||||||
if (data.vitality >= data.upVitality)
|
|
||||||
|
long maxVitality = await _attrService.GetUserMaxVitality(userId);
|
||||||
|
if (data.vitality >= maxVitality)
|
||||||
{
|
{
|
||||||
return PoAction.Message("活力满满,无需恢复!");
|
return PoAction.Message("活力满满,无需恢复!");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result = await _attrService.UpdateUserVigour(userId, 2, (long)data.upVitality,time);
|
bool result = await _attrService.UpdateUserVigour(userId, 2, maxVitality, time);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
return PoAction.Ok(true);
|
return PoAction.Ok(true);
|
||||||
@@ -245,8 +249,9 @@ public class RecoverController : ControllerBase
|
|||||||
var data = await _equService.GetUserOnEqu(userId);
|
var data = await _equService.GetUserOnEqu(userId);
|
||||||
var needData = data.FindAll(it =>
|
var needData = data.FindAll(it =>
|
||||||
it.isAppr == 1 && it.durability < it.maxdurability && it.useEndTime > TimeExtend.GetTimeStampSeconds);
|
it.isAppr == 1 && it.durability < it.maxdurability && it.useEndTime > TimeExtend.GetTimeStampSeconds);
|
||||||
need = needData.Sum(it => (int)it.maxdurability - (int)it.durability);
|
need = needData.Sum(it => (int)it.maxdurability - (int)it.durability);
|
||||||
return PoAction.Ok(new { data, need });
|
need = need * 500;
|
||||||
|
return PoAction.Ok(new { data, need });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -256,7 +261,7 @@ public class RecoverController : ControllerBase
|
|||||||
/// <param name="ueId"></param>
|
/// <param name="ueId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<IPoAction> RecoverEqu(int npcId,string? ueId)
|
public async Task<IPoAction> RecoverEqu(int npcId, string? ueId)
|
||||||
{
|
{
|
||||||
string userId = StateHelper.userId;
|
string userId = StateHelper.userId;
|
||||||
|
|
||||||
@@ -292,11 +297,12 @@ public class RecoverController : ControllerBase
|
|||||||
myEqu = myEqu.FindAll(it =>
|
myEqu = myEqu.FindAll(it =>
|
||||||
it.isAppr == 1 && it.durability < it.maxdurability && it.useEndTime > TimeExtend.GetTimeStampSeconds);
|
it.isAppr == 1 && it.durability < it.maxdurability && it.useEndTime > TimeExtend.GetTimeStampSeconds);
|
||||||
int need = myEqu.Sum(it => (int)it.maxdurability - (int)it.durability);
|
int need = myEqu.Sum(it => (int)it.maxdurability - (int)it.durability);
|
||||||
|
need = need * 500;
|
||||||
if (need < 1)
|
if (need < 1)
|
||||||
{
|
{
|
||||||
return PoAction.Message("耐久已满,无需恢复!");
|
return PoAction.Message("耐久已满,无需恢复!");
|
||||||
}
|
}
|
||||||
|
|
||||||
var myAcc = await _accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
|
var myAcc = await _accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
|
||||||
if (need > myAcc)
|
if (need > myAcc)
|
||||||
{
|
{
|
||||||
@@ -310,6 +316,7 @@ public class RecoverController : ControllerBase
|
|||||||
item.durability = item.maxdurability;
|
item.durability = item.maxdurability;
|
||||||
await _equService.UpdateUserEquInfo(item);
|
await _equService.UpdateUserEquInfo(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return PoAction.Ok(true, $"恢复成功,花费{need}铜贝!");
|
return PoAction.Ok(true, $"恢复成功,花费{need}铜贝!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -346,6 +353,7 @@ public class RecoverController : ControllerBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
int need = (int)equInfo.maxdurability - (int)equInfo.durability;
|
int need = (int)equInfo.maxdurability - (int)equInfo.durability;
|
||||||
|
need = need * 500;
|
||||||
var myAcc = await _accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
|
var myAcc = await _accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
|
||||||
if (need > myAcc)
|
if (need > myAcc)
|
||||||
{
|
{
|
||||||
@@ -369,27 +377,5 @@ public class RecoverController : ControllerBase
|
|||||||
return PoAction.Message("恢复失败,请稍后尝试!");
|
return PoAction.Message("恢复失败,请稍后尝试!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var data = await _attrService.GetUserVigourInfo(userId);
|
|
||||||
string time = TimeAssist.GetDateTimeYMDString(0);
|
|
||||||
if (data.upTime == time)
|
|
||||||
{
|
|
||||||
return PoAction.Message("今天已恢复过活力啦!");
|
|
||||||
}
|
|
||||||
if (data.vitality >= data.upVitality)
|
|
||||||
{
|
|
||||||
return PoAction.Message("活力满满,无需恢复!");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool result = await _attrService.UpdateUserVigour(userId, 2, (long)data.upVitality,time);
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
return PoAction.Ok(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return PoAction.Message("恢复失败,请稍后尝试!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,10 +15,11 @@ public class TradeController : ControllerBase
|
|||||||
private readonly IGameChatService _chatService;
|
private readonly IGameChatService _chatService;
|
||||||
private readonly IUnitUserAttrService _attrService;
|
private readonly IUnitUserAttrService _attrService;
|
||||||
private readonly ITradeService _tradeService;
|
private readonly ITradeService _tradeService;
|
||||||
|
private readonly IUnitUserAccService _accService;
|
||||||
|
|
||||||
public TradeController(IGameGoodsService goodsService, IGameEquService equService, IUnitUserWeight weightService,
|
public TradeController(IGameGoodsService goodsService, IGameEquService equService, IUnitUserWeight weightService,
|
||||||
IUnitUserService userService, IGameChatService chatService,
|
IUnitUserService userService, IGameChatService chatService,
|
||||||
IUnitUserAttrService attrService, ITradeService tradeService)
|
IUnitUserAttrService attrService, ITradeService tradeService, IUnitUserAccService accService)
|
||||||
{
|
{
|
||||||
_goodsService = goodsService;
|
_goodsService = goodsService;
|
||||||
_equService = equService;
|
_equService = equService;
|
||||||
@@ -27,6 +28,7 @@ public class TradeController : ControllerBase
|
|||||||
_chatService = chatService;
|
_chatService = chatService;
|
||||||
_attrService = attrService;
|
_attrService = attrService;
|
||||||
_tradeService = tradeService;
|
_tradeService = tradeService;
|
||||||
|
_accService = accService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -41,6 +43,12 @@ public class TradeController : ControllerBase
|
|||||||
{
|
{
|
||||||
count = count < 1 ? 1 : count;
|
count = count < 1 ? 1 : count;
|
||||||
string userId = StateHelper.userId;
|
string userId = StateHelper.userId;
|
||||||
|
int areaId = StateHelper.areaId;
|
||||||
|
if (price > 100000000000)
|
||||||
|
{
|
||||||
|
return PoAction.Message("最大单价不能超过10万金!");
|
||||||
|
}
|
||||||
|
|
||||||
int lev = await _attrService.GetUserLev(userId);
|
int lev = await _attrService.GetUserLev(userId);
|
||||||
if (lev < 60)
|
if (lev < 60)
|
||||||
{
|
{
|
||||||
@@ -75,7 +83,7 @@ public class TradeController : ControllerBase
|
|||||||
if (await _equService.DeductUserEqu(userId, [equInfo], "寄售装备"))
|
if (await _equService.DeductUserEqu(userId, [equInfo], "寄售装备"))
|
||||||
{
|
{
|
||||||
string data = JsonConvert.SerializeObject(equInfo);
|
string data = JsonConvert.SerializeObject(equInfo);
|
||||||
if (await _tradeService.AddTrade(userId, nameof(GameEnum.PropCode.Equ), equInfo.unitEquName,
|
if (await _tradeService.AddTrade(areaId, userId, nameof(GameEnum.PropCode.Equ), equInfo.unitEquName,
|
||||||
equInfo.ueId, 1, price, data))
|
equInfo.ueId, 1, price, data))
|
||||||
{
|
{
|
||||||
return PoAction.Ok(true);
|
return PoAction.Ok(true);
|
||||||
@@ -123,7 +131,8 @@ public class TradeController : ControllerBase
|
|||||||
|
|
||||||
if (await _goodsService.UpdateUserGoods(userId, 0, goodsId, count, "寄售物品"))
|
if (await _goodsService.UpdateUserGoods(userId, 0, goodsId, count, "寄售物品"))
|
||||||
{
|
{
|
||||||
if (await _tradeService.AddTrade(userId, nameof(GameEnum.PropCode.Goods), MyGoods.goodsName, prop,
|
if (await _tradeService.AddTrade(areaId, userId, nameof(GameEnum.PropCode.Goods), MyGoods.goodsName,
|
||||||
|
prop,
|
||||||
count, price,
|
count, price,
|
||||||
""))
|
""))
|
||||||
{
|
{
|
||||||
@@ -145,4 +154,247 @@ public class TradeController : ControllerBase
|
|||||||
return PoAction.Message("该物品不允许寄售!");
|
return PoAction.Message("该物品不允许寄售!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 购买
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tradeId"></param>
|
||||||
|
/// <param name="count"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IPoAction> Buy(string tradeId, int count)
|
||||||
|
{
|
||||||
|
count = count < 1 ? 1 : count;
|
||||||
|
string userId = StateHelper.userId;
|
||||||
|
int areaId = StateHelper.areaId;
|
||||||
|
|
||||||
|
var info = await _tradeService.GetTradeInfo(tradeId);
|
||||||
|
if (info == null)
|
||||||
|
{
|
||||||
|
return PoAction.Message("交易信息不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.areaId != areaId)
|
||||||
|
{
|
||||||
|
return PoAction.Message("交易信息不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.count < count)
|
||||||
|
{
|
||||||
|
return PoAction.Message("交易剩余数量不足!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.code == nameof(GameEnum.PropCode.Equ))
|
||||||
|
{
|
||||||
|
unit_user_equ equInfo = JsonConvert.DeserializeObject<unit_user_equ>(info.content);
|
||||||
|
if (await _weightService.CheckUserWeight(userId, (int)equInfo.weight)==false)
|
||||||
|
{
|
||||||
|
return PoAction.Message("您的负重不足!");
|
||||||
|
}
|
||||||
|
|
||||||
|
var myAcc = await _accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
|
||||||
|
if (myAcc < info.price)
|
||||||
|
{
|
||||||
|
return PoAction.Message("您的铜贝不足!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (await _accService.UpdateUserCopper(userId, 0, (long)info.price, $"交易支付:{info.name}"))
|
||||||
|
{
|
||||||
|
if (await _tradeService.UpdateTradeCount(info.tradeId, 0, 1, true))
|
||||||
|
{
|
||||||
|
equInfo.userId = userId;
|
||||||
|
await _equService.AddUserEqu(equInfo, "交易获得");
|
||||||
|
long GetCopper = Convert.ToInt64(info.price * 0.9M);
|
||||||
|
if (await _accService.UpdateUserCopper(info.userId, 1, GetCopper, $"交易收入:{info.name}"))
|
||||||
|
{
|
||||||
|
string msg = $"您的装备[{info.name}]成功交易,交易价格{info.price}铜贝,到账{GetCopper}铜贝!";
|
||||||
|
await _chatService.SendChat(info.userId, areaId, nameof(GameChatEnum.Code.Notice), msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PoAction.Ok(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PoAction.Message("交易失败,请稍后尝试!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PoAction.Message("交易失败,请稍后尝试!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (info.code == nameof(GameEnum.PropCode.Goods))
|
||||||
|
{
|
||||||
|
var goodsInfo = await _goodsService.GetGoodsInfo(Convert.ToInt32(info.propId));
|
||||||
|
int needWeight = (int)goodsInfo.weight * count;
|
||||||
|
if (await _weightService.CheckUserWeight(userId, needWeight)==false)
|
||||||
|
{
|
||||||
|
return PoAction.Message("您的负重不足!");
|
||||||
|
}
|
||||||
|
var myAcc = await _accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
|
||||||
|
var needCopper = Convert.ToInt64(info.price) * count;
|
||||||
|
if (myAcc < needCopper)
|
||||||
|
{
|
||||||
|
return PoAction.Message("您的铜贝不足!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (await _accService.UpdateUserCopper(userId, 0, needCopper, $"交易支付:{info.name}×{count}"))
|
||||||
|
{
|
||||||
|
if (await _tradeService.UpdateTradeCount(info.tradeId, 0, count, info.count == count))
|
||||||
|
{
|
||||||
|
long GetCopper = Convert.ToInt64(needCopper * 0.9M);
|
||||||
|
if (await _accService.UpdateUserCopper(info.userId, 1, GetCopper, $"交易收入:{info.name}"))
|
||||||
|
{
|
||||||
|
await _goodsService.UpdateUserGoods(userId, 1, Convert.ToInt32(info.propId), count, "交易获得");
|
||||||
|
string msg = $"您成功交易物品[{info.name}]×{count},交易价格{needCopper}铜贝,到账{GetCopper}铜贝!";
|
||||||
|
await _chatService.SendChat(info.userId, areaId, nameof(GameChatEnum.Code.Notice), msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PoAction.Ok(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PoAction.Message("交易失败,请稍后尝试!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PoAction.Message("交易失败,请稍后尝试!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PoAction.Message("交易失败,请稍后尝试!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取交易列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="no"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="page"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IPoAction> GetTradeData(string? no, int type, string? query, int page)
|
||||||
|
{
|
||||||
|
string userId = string.Empty;
|
||||||
|
int areaId = StateHelper.areaId;
|
||||||
|
if (!string.IsNullOrEmpty(no))
|
||||||
|
{
|
||||||
|
var userInfo = await _userService.GetUserInfoByUserNo(no);
|
||||||
|
if (userInfo != null)
|
||||||
|
{
|
||||||
|
userId = userInfo.userId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RefAsync<int> total = 0;
|
||||||
|
var data = await _tradeService.GetUserTradeData(areaId, userId, type, query, page, 10, total);
|
||||||
|
return PoAction.Ok(new { data, total = total.Value });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取个人交易列表
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IPoAction> GetMyTrade()
|
||||||
|
{
|
||||||
|
string userId = StateHelper.userId;
|
||||||
|
var data = await _tradeService.GetUserTradeData(userId);
|
||||||
|
return PoAction.Ok(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下架交易
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tradeId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IPoAction> DownTrade(string tradeId)
|
||||||
|
{
|
||||||
|
string userId = StateHelper.userId;
|
||||||
|
var info = await _tradeService.GetTradeInfo(tradeId);
|
||||||
|
if (info == null)
|
||||||
|
{
|
||||||
|
return PoAction.Message("交易信息不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.userId != userId)
|
||||||
|
{
|
||||||
|
return PoAction.Message("交易信息不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.code == nameof(GameEnum.PropCode.Equ))
|
||||||
|
{
|
||||||
|
if (await _tradeService.UpdateTradeCount(info.tradeId, 0, 1, true))
|
||||||
|
{
|
||||||
|
unit_user_equ equInfo = JsonConvert.DeserializeObject<unit_user_equ>(info.content);
|
||||||
|
await _equService.AddUserEqu(equInfo, "下架交易装备");
|
||||||
|
return PoAction.Ok(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PoAction.Message("下架失败,请稍后尝试!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (info.code == nameof(GameEnum.PropCode.Goods))
|
||||||
|
{
|
||||||
|
int count = Convert.ToInt32(info.count);
|
||||||
|
if (await _tradeService.UpdateTradeCount(info.tradeId, 0, count, true))
|
||||||
|
{
|
||||||
|
await _goodsService.UpdateUserGoods(userId, 1, Convert.ToInt32(info.propId), count, "下架交易物品");
|
||||||
|
return PoAction.Ok(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PoAction.Message("下架失败,请稍后尝试!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PoAction.Message("下架失败,请稍后尝试!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取交易详情
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tradeId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IPoAction> GetTradeInfo(string tradeId)
|
||||||
|
{
|
||||||
|
string userId = StateHelper.userId;
|
||||||
|
int areaId = StateHelper.areaId;
|
||||||
|
var info = await _tradeService.GetTradeInfo(tradeId);
|
||||||
|
if (info == null)
|
||||||
|
{
|
||||||
|
return PoAction.Message("交易信息不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.areaId != areaId)
|
||||||
|
{
|
||||||
|
return PoAction.Message("交易信息不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.code != nameof(GameEnum.PropCode.Equ))
|
||||||
|
{
|
||||||
|
return PoAction.Message(info.propId, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
var ueInfo = JsonConvert.DeserializeObject<unit_user_equ>(info.content);
|
||||||
|
var equInfo = await _equService.GetEquInfo((int)ueInfo.equId);
|
||||||
|
|
||||||
|
game_equ_suit suit = new game_equ_suit();
|
||||||
|
if (ueInfo.suitCode != "0" && !string.IsNullOrEmpty(ueInfo.suitCode))
|
||||||
|
{
|
||||||
|
suit = await _equService.GetEuqSuitInfo(ueInfo.suitCode);
|
||||||
|
}
|
||||||
|
UserModel user = await UserModelTool.GetUserView(ueInfo.owerId);
|
||||||
|
|
||||||
|
return PoAction.Ok(new { equ = equInfo, suit, equData = ueInfo, user });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -257,6 +257,15 @@ public class GiveController : ControllerBase
|
|||||||
{
|
{
|
||||||
return PoAction.Message("玩家不存在!");
|
return PoAction.Message("玩家不存在!");
|
||||||
}
|
}
|
||||||
|
//此处判断赠送玩家的设置
|
||||||
|
var roleConfig = await _userService.GetUserConfigInfo(fromInfo.userId);
|
||||||
|
if (roleConfig.giveRole == 1)//判断是否为好友
|
||||||
|
{
|
||||||
|
if (await _relationService.CheckIsFriend(userId, fromInfo.userId)==false)
|
||||||
|
{
|
||||||
|
return PoAction.Message("玩家设置了拒绝陌生人赠送!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (type == 0)
|
if (type == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,14 +15,18 @@ public class RelationController : ControllerBase
|
|||||||
private readonly IUnitUserService _userService;
|
private readonly IUnitUserService _userService;
|
||||||
private readonly IMessageService _messageService;
|
private readonly IMessageService _messageService;
|
||||||
private readonly IUnitUserAccService _accService;
|
private readonly IUnitUserAccService _accService;
|
||||||
|
private readonly IUnitUserAttrService _attrService;
|
||||||
|
private readonly IGameChatService _chatService;
|
||||||
|
|
||||||
public RelationController(IUnitUserRelationService relationService, IUnitUserService userService,
|
public RelationController(IUnitUserRelationService relationService, IUnitUserService userService,
|
||||||
IMessageService messageService, IUnitUserAccService accService)
|
IMessageService messageService, IUnitUserAccService accService,IUnitUserAttrService attrService,IGameChatService chatService)
|
||||||
{
|
{
|
||||||
_relationService = relationService;
|
_relationService = relationService;
|
||||||
_userService = userService;
|
_userService = userService;
|
||||||
_messageService = messageService;
|
_messageService = messageService;
|
||||||
_accService = accService;
|
_accService = accService;
|
||||||
|
_attrService = attrService;
|
||||||
|
_chatService = chatService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -218,17 +222,37 @@ public class RelationController : ControllerBase
|
|||||||
return PoAction.Message("已经是仇人啦,无需重复添加!");
|
return PoAction.Message("已经是仇人啦,无需重复添加!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int needGold = GameConfig.GameRelationEnemyNeedGold;
|
||||||
|
int lev = await _attrService.GetUserLev(userInfo.userId);
|
||||||
|
if (lev <= 30)
|
||||||
|
{
|
||||||
|
return PoAction.Message("对方不大于30级无法添加加为仇人!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lev > 120 && lev <= 220)
|
||||||
|
{
|
||||||
|
needGold = needGold * 3;
|
||||||
|
}
|
||||||
|
else if (lev > 220)
|
||||||
|
{
|
||||||
|
needGold = needGold * 5;
|
||||||
|
}
|
||||||
|
|
||||||
var myAcc = await _accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.gold));
|
var myAcc = await _accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.gold));
|
||||||
if (myAcc < GameConfig.GameRelationEnemyNeedGold)
|
if (myAcc < needGold)
|
||||||
{
|
{
|
||||||
return PoAction.Message("您的金元不足!");
|
return PoAction.Message("您的金元不足!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (await _accService.UpdateUserAcc(userId, 0, nameof(AccEnum.AccType.gold),
|
if (await _accService.UpdateUserAcc(userId, 0, nameof(AccEnum.AccType.gold),
|
||||||
GameConfig.GameRelationEnemyNeedGold, nameof(AccEnum.Name.其他), "添加仇人"))
|
needGold, nameof(AccEnum.Name.其他), "添加仇人"))
|
||||||
{
|
{
|
||||||
if (await _relationService.AddUserEnemy(userId, userInfo.userId))
|
if (await _relationService.AddUserEnemy(userId, userInfo.userId))
|
||||||
{
|
{
|
||||||
|
var myInfo = await _userService.GetUserInfoByUserId(userId);
|
||||||
|
string msg = $"请注意,您已被[{UbbTool.HomeUbb(myInfo.userNo, myInfo.nick)}]添加为仇人,被对方击杀将会受到严重惩罚!";
|
||||||
|
await _chatService.SendChat(userInfo.userId, (int)userInfo.areaId, nameof(GameChatEnum.Code.Notice), msg);
|
||||||
|
|
||||||
return PoAction.Ok(true, "仇人添加成功!");
|
return PoAction.Ok(true, "仇人添加成功!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Photon.Core.Timer;
|
using Photon.Core.Timer;
|
||||||
using Quartz;
|
using Quartz;
|
||||||
namespace Application.Domain;
|
namespace Application.Web;
|
||||||
|
|
||||||
public class AutoJob: ITimerAutoJob
|
public class AutoJob: ITimerAutoJob
|
||||||
{
|
{
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
using Quartz;
|
using Quartz;
|
||||||
using Quartz.Spi;
|
using Quartz.Spi;
|
||||||
|
|
||||||
namespace Application.Domain;
|
namespace Application.Web;
|
||||||
public class JobStart: ITimerAutoStart
|
public class JobStart: ITimerAutoStart
|
||||||
{
|
{
|
||||||
private readonly ISchedulerFactory _schedulerFactory;
|
private readonly ISchedulerFactory _schedulerFactory;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Photon.Core.Timer;
|
using Photon.Core.Timer;
|
||||||
using Quartz;
|
using Quartz;
|
||||||
|
|
||||||
namespace Application.Domain;
|
namespace Application.Web;
|
||||||
|
|
||||||
public class TimerJobManager : ITimerJobManager
|
public class TimerJobManager : ITimerJobManager
|
||||||
{
|
{
|
||||||
@@ -7,17 +7,17 @@
|
|||||||
{
|
{
|
||||||
"type": 0,
|
"type": 0,
|
||||||
"name": "Kg.SeaTime.Game",
|
"name": "Kg.SeaTime.Game",
|
||||||
"connect": "data source=192.168.0.88;database=kg.seatime.game;user id=root;password=1f5ozxRGE3Y;pooling=true;port=3306;sslmode=Required;charset=utf8mb4;"
|
"connect": "data source=81.70.212.61;database=kg.seatime.game;user id=root;password=1f5ozxRGE3Y;pooling=true;port=3306;sslmode=Required;charset=utf8mb4;"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": 0,
|
"type": 0,
|
||||||
"name": "Kg.SeaTime.Resource",
|
"name": "Kg.SeaTime.Resource",
|
||||||
"connect": "data source=192.168.0.88;database=kg.seatime.resource;user id=root;password=1f5ozxRGE3Y;pooling=true;port=3306;sslmode=Required;charset=utf8mb4;"
|
"connect": "data source=81.70.212.61;database=kg.seatime.resource;user id=root;password=1f5ozxRGE3Y;pooling=true;port=3306;sslmode=Required;charset=utf8mb4;"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": 0,
|
"type": 0,
|
||||||
"name": "Kg.SeaTime.Log",
|
"name": "Kg.SeaTime.Log",
|
||||||
"connect": "data source=192.168.0.88;database=kg.seatime.log;user id=root;password=1f5ozxRGE3Y;pooling=true;port=3306;sslmode=Required;charset=utf8mb4;"
|
"connect": "data source=81.70.212.61;database=kg.seatime.log;user id=root;password=1f5ozxRGE3Y;pooling=true;port=3306;sslmode=Required;charset=utf8mb4;"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"JwtTokenOptions": {
|
"JwtTokenOptions": {
|
||||||
|
|||||||
43
Service/Application.Web/applicationsettings.txt
Normal file
43
Service/Application.Web/applicationsettings.txt
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"AutoProgram": 0,
|
||||||
|
"Redis": {
|
||||||
|
"connection": "127.0.0.1:6379,password=,defaultdatabase=5"
|
||||||
|
},
|
||||||
|
"SqlData": [
|
||||||
|
{
|
||||||
|
"type": 0,
|
||||||
|
"name": "Kg.SeaTime.Game",
|
||||||
|
"connect": "data source=81.70.212.61;database=kg.seatime.game;user id=root;password=1f5ozxRGE3Y;pooling=true;port=3306;sslmode=Required;charset=utf8mb4;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": 0,
|
||||||
|
"name": "Kg.SeaTime.Resource",
|
||||||
|
"connect": "data source=81.70.212.61;database=kg.seatime.resource;user id=root;password=1f5ozxRGE3Y;pooling=true;port=3306;sslmode=Required;charset=utf8mb4;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": 0,
|
||||||
|
"name": "Kg.SeaTime.Log",
|
||||||
|
"connect": "data source=81.70.212.61;database=kg.seatime.log;user id=root;password=1f5ozxRGE3Y;pooling=true;port=3306;sslmode=Required;charset=utf8mb4;"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"JwtTokenOptions": {
|
||||||
|
"Issuer": "kx.seatime",
|
||||||
|
"Audience": "kx.seatime",
|
||||||
|
"SecurityKey": "46055HR0n7FeNHhDKAYD2i9ZsdsYn4jn"
|
||||||
|
},
|
||||||
|
"ResUrl": {
|
||||||
|
"local": "http://192.168.0.142:5298",
|
||||||
|
"resUrl": "http://localhost:12206",
|
||||||
|
"imgCDN": "/",
|
||||||
|
"videoCDN": "/"
|
||||||
|
},
|
||||||
|
"Sms": {
|
||||||
|
"SmsType": 1,
|
||||||
|
"AccessKey": "AKIDVptgCRP5UcT4PTGm1yf5E6pKYVBajeKn",
|
||||||
|
"Secret": "FG2atxlKflcEclgKhnc9XeU3LM6YjdGf",
|
||||||
|
"signName": "探玩驿站",
|
||||||
|
"TemplateCode": "963929",
|
||||||
|
"SmsSdkAppId": "1400523979",
|
||||||
|
"SmsOnTime": 300
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
<div class="timeService">
|
<div class="timeService">
|
||||||
小G报时({{ timeTips }})
|
小G报时({{ timeTips }})
|
||||||
</div>
|
</div>
|
||||||
<p style="font-weight:bold;font-size:14px">官方QQ群:931835791</p>
|
<p style="font-weight:bold;font-size:14px">官方QQ群:238938639</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
统一配置中心
|
统一配置中心
|
||||||
*/
|
*/
|
||||||
export class BaseConfig {
|
export class BaseConfig {
|
||||||
public static BaseUrl: string = 'https://192.168.0.142:7198'
|
public static BaseUrl: string = 'https://localhost:7198'
|
||||||
public static BaseMediaUrl: string = 'https://192.168.0.142:7198/'
|
public static BaseMediaUrl: string = 'https://localhost:7198/'
|
||||||
// public static BaseUrl:string="http://v3.pccsh.com";
|
// public static BaseUrl:string="http://v3.pccsh.com";
|
||||||
// public static BaseMediaUrl:string="http://v3.pccsh.com";
|
// public static BaseMediaUrl:string="http://v3.pccsh.com";
|
||||||
}
|
}
|
||||||
|
|||||||
51
Web/src/pages/business/cdk.vue
Normal file
51
Web/src/pages/business/cdk.vue
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<template>
|
||||||
|
<div class="module-title">
|
||||||
|
CDK兑换
|
||||||
|
</div>
|
||||||
|
<div class="module-content tips" style="font-size:14px;">
|
||||||
|
亲爱的航海家,CDK码可以在这里兑换奖励哦!
|
||||||
|
</div>
|
||||||
|
<div class="module-content">
|
||||||
|
<div class="input">
|
||||||
|
CDK码:<input name="cdk" placeholder="请输入CDK" class="ipt" type="text" v-model="no">
|
||||||
|
</div>
|
||||||
|
<div class="input" style="margin-top: 10px;">
|
||||||
|
<input type="button" value="立即兑换" class="btn btn-danger" @click="exchange" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
layout: layout.default,
|
||||||
|
middleware: 'page-loading'
|
||||||
|
})
|
||||||
|
|
||||||
|
const no = ref('');
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
PageLoading.Close();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const exchange = async () => {
|
||||||
|
if (no.value == '') {
|
||||||
|
MessageExtend.ShowToast("CDK不能为空!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MessageExtend.LoadingToast("兑换中...");
|
||||||
|
let result = await CdkService.Exchange(no.value);
|
||||||
|
MessageExtend.LoadingClose();
|
||||||
|
if (result.code == 0) {
|
||||||
|
no.value = '';
|
||||||
|
MessageExtend.Notify(result.msg, "success", 5000);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MessageExtend.ShowDialog("提示", result.msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -12,7 +12,9 @@
|
|||||||
{{ index + 1 }}.<GameEqu :equ-data="item" :show-lev="1" :show-url="true"></GameEqu>
|
{{ index + 1 }}.<GameEqu :equ-data="item" :show-lev="1" :show-url="true"></GameEqu>
|
||||||
<span>({{ item.durability }}/{{ item.maxdurability }})</span>
|
<span>({{ item.durability }}/{{ item.maxdurability }})</span>
|
||||||
<span v-if="item.durability < item.maxdurability">
|
<span v-if="item.durability < item.maxdurability">
|
||||||
[<Abutton @click="retEqu(item.ueId)">修复({{ item.maxdurability - item.durability }}铜)</Abutton>]
|
[<Abutton @click="retEqu(item.ueId)">修复({{ GameTool.FormatCopper((item.maxdurability -
|
||||||
|
item.durability) * 500) }})</Abutton>
|
||||||
|
]
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -24,7 +26,7 @@
|
|||||||
<div class="content" style="font-size: 16px;">
|
<div class="content" style="font-size: 16px;">
|
||||||
说明:<br>
|
说明:<br>
|
||||||
1.装备仅可修复当前穿戴中的装备。<br>
|
1.装备仅可修复当前穿戴中的装备。<br>
|
||||||
2.每修复1点耐久消耗1铜贝。
|
2.每修复1点耐久消耗500铜。
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -51,7 +53,7 @@ const BindData = async (): Promise<void> => {
|
|||||||
allCopper.value = result.data.need;
|
allCopper.value = result.data.need;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MessageExtend.ShowDialog("强化装备", result.msg);
|
MessageExtend.ShowDialog("修理装备", result.msg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
【恢复活力】
|
【恢复活力】
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
当前活力:{{ data.vitality }}/{{ data.upVitality }}
|
当前活力:{{ data.vitality }}/{{ maxVigour }}
|
||||||
</div>
|
</div>
|
||||||
<div class="content" v-if="data.vitality < data.upVitality">
|
<div class="content" v-if="data.vitality < maxVigour">
|
||||||
[<Abutton @click="Recover">立即恢复</Abutton>]
|
[<Abutton @click="Recover">立即恢复</Abutton>]
|
||||||
</div>
|
</div>
|
||||||
<div class="content" v-else>
|
<div class="content" v-else>
|
||||||
@@ -19,6 +19,7 @@ definePageMeta({
|
|||||||
middleware: 'page-loading'
|
middleware: 'page-loading'
|
||||||
})
|
})
|
||||||
const data = ref<any>({});
|
const data = ref<any>({});
|
||||||
|
const maxVigour = ref(0);
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
await BindData();
|
await BindData();
|
||||||
@@ -33,7 +34,8 @@ onMounted(async () => {
|
|||||||
const BindData = async (): Promise<void> => {
|
const BindData = async (): Promise<void> => {
|
||||||
let result = await RecoverService.GetUserVigour()
|
let result = await RecoverService.GetUserVigour()
|
||||||
if (result.code == 0) {
|
if (result.code == 0) {
|
||||||
data.value = result.data;
|
data.value = result.data.data;
|
||||||
|
maxVigour.value = result.data.maxVigour;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MessageExtend.ShowDialog("提示", result.msg);
|
MessageExtend.ShowDialog("提示", result.msg);
|
||||||
|
|||||||
@@ -51,8 +51,7 @@ const BindData = async (): Promise<void> => {
|
|||||||
data.value = result.data.data;
|
data.value = result.data.data;
|
||||||
verifyData.value = result.data.result;
|
verifyData.value = result.data.result;
|
||||||
needs.value = verifyData.value.needs;
|
needs.value = verifyData.value.needs;
|
||||||
content.value = JSON.parse(data.value.busContent);
|
content.value = JSON.parse(data.value.busContent);
|
||||||
console.log(result.data);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MessageExtend.ShowDialogEvent("提示", result.msg, () => {
|
MessageExtend.ShowDialogEvent("提示", result.msg, () => {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user