Update RoleController.cs

This commit is contained in:
thexeondev 2024-02-23 13:24:02 +03:00 committed by GitHub
parent 32349137d3
commit 3cf22f41d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -57,33 +57,30 @@ internal class RoleController : Controller
[NetEvent(MessageId.ResonantChainUnlockRequest)] [NetEvent(MessageId.ResonantChainUnlockRequest)]
public RpcResult OnResonantChainUnlockRequest(ResonantChainUnlockRequest request, ModelManager modelManager, ConfigManager configManager) public RpcResult OnResonantChainUnlockRequest(ResonantChainUnlockRequest request, ModelManager modelManager, ConfigManager configManager)
{ {
roleInfo _roleInfo = modelManager.Roles.Roles.Find(r => r.RoleId == request.RoleId)!; roleInfo? role = modelManager.Roles.Roles.Find(r => r.RoleId == request.RoleId)!;
if (_roleInfo != null) if (role != null)
{ {
RoleInfoConfig roleConfig = configManager.GetConfig<RoleInfoConfig>(request.RoleId)!; RoleInfoConfig roleConfig = configManager.GetConfig<RoleInfoConfig>(request.RoleId)!;
if (roleConfig != null) int resonantChainGroupId = roleConfig.ResonantChainGroupId;
// Todo: add buff by _resonantChainGroupId
int curr = role.ResonantChainGroupIndex;
int next = Math.Min(curr + 1, 6);
role.ResonantChainGroupIndex = next;
return Response(MessageId.ResonantChainUnlockResponse, new ResonantChainUnlockResponse
{ {
int _resonantChainGroupId = roleConfig.ResonantChainGroupId; RoleId = request.RoleId,
ResonantChainGroupIndex = next
// Todo: add buff by _resonantChainGroupId });
int _curr = _roleInfo.ResonantChainGroupIndex;
int _next = Math.Min(_curr + 1, 6);
_roleInfo.ResonantChainGroupIndex = _next;
return Response(MessageId.ResonantChainUnlockResponse, new ResonantChainUnlockResponse
{
RoleId = request.RoleId,
ResonantChainGroupIndex = _next
});
}
} }
return Response(MessageId.ResonantChainUnlockResponse, new ResonantChainUnlockResponse return Response(MessageId.ResonantChainUnlockResponse, new ResonantChainUnlockResponse
{ {
RoleId = request.RoleId, ErrCode = (int)ErrorCode.ErrRoleResonNotActive
}); });
} }