12121
This commit is contained in:
@@ -15,14 +15,18 @@ public class RelationController : ControllerBase
|
||||
private readonly IUnitUserService _userService;
|
||||
private readonly IMessageService _messageService;
|
||||
private readonly IUnitUserAccService _accService;
|
||||
private readonly IUnitUserAttrService _attrService;
|
||||
private readonly IGameChatService _chatService;
|
||||
|
||||
public RelationController(IUnitUserRelationService relationService, IUnitUserService userService,
|
||||
IMessageService messageService, IUnitUserAccService accService)
|
||||
IMessageService messageService, IUnitUserAccService accService,IUnitUserAttrService attrService,IGameChatService chatService)
|
||||
{
|
||||
_relationService = relationService;
|
||||
_userService = userService;
|
||||
_messageService = messageService;
|
||||
_accService = accService;
|
||||
_attrService = attrService;
|
||||
_chatService = chatService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -218,17 +222,37 @@ public class RelationController : ControllerBase
|
||||
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));
|
||||
if (myAcc < GameConfig.GameRelationEnemyNeedGold)
|
||||
if (myAcc < needGold)
|
||||
{
|
||||
return PoAction.Message("您的金元不足!");
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
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, "仇人添加成功!");
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user