Update RoleController.cs
This commit is contained in:
parent
32349137d3
commit
3cf22f41d9
1 changed files with 18 additions and 21 deletions
|
@ -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;
|
||||||
{
|
|
||||||
int _resonantChainGroupId = roleConfig.ResonantChainGroupId;
|
|
||||||
|
|
||||||
// Todo: add buff by _resonantChainGroupId
|
// Todo: add buff by _resonantChainGroupId
|
||||||
|
|
||||||
int _curr = _roleInfo.ResonantChainGroupIndex;
|
int curr = role.ResonantChainGroupIndex;
|
||||||
int _next = Math.Min(_curr + 1, 6);
|
int next = Math.Min(curr + 1, 6);
|
||||||
_roleInfo.ResonantChainGroupIndex = _next;
|
role.ResonantChainGroupIndex = next;
|
||||||
|
|
||||||
return Response(MessageId.ResonantChainUnlockResponse, new ResonantChainUnlockResponse
|
return Response(MessageId.ResonantChainUnlockResponse, new ResonantChainUnlockResponse
|
||||||
{
|
{
|
||||||
RoleId = request.RoleId,
|
RoleId = request.RoleId,
|
||||||
ResonantChainGroupIndex = _next
|
ResonantChainGroupIndex = next
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return Response(MessageId.ResonantChainUnlockResponse, new ResonantChainUnlockResponse
|
return Response(MessageId.ResonantChainUnlockResponse, new ResonantChainUnlockResponse
|
||||||
{
|
{
|
||||||
RoleId = request.RoleId,
|
ErrCode = (int)ErrorCode.ErrRoleResonNotActive
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue