Merge pull request #4 from ryozm/feat-/resonantChainUnlock

Support unlocking Resonance Chains.
This commit is contained in:
thexeondev 2024-02-23 13:24:16 +03:00 committed by GitHub
commit 97bbbbeae9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -54,6 +54,36 @@ internal class RoleController : Controller
[NetEvent(MessageId.RoleFavorListRequest)] [NetEvent(MessageId.RoleFavorListRequest)]
public RpcResult OnRoleFavorListRequest() => Response(MessageId.RoleFavorListResponse, new RoleFavorListResponse()); public RpcResult OnRoleFavorListRequest() => Response(MessageId.RoleFavorListResponse, new RoleFavorListResponse());
[NetEvent(MessageId.ResonantChainUnlockRequest)]
public RpcResult OnResonantChainUnlockRequest(ResonantChainUnlockRequest request, ModelManager modelManager, ConfigManager configManager)
{
roleInfo? role = modelManager.Roles.Roles.Find(r => r.RoleId == request.RoleId)!;
if (role != null)
{
RoleInfoConfig roleConfig = configManager.GetConfig<RoleInfoConfig>(request.RoleId)!;
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
{
RoleId = request.RoleId,
ResonantChainGroupIndex = next
});
}
return Response(MessageId.ResonantChainUnlockResponse, new ResonantChainUnlockResponse
{
ErrCode = (int)ErrorCode.ErrRoleResonNotActive
});
}
private static List<ArrayIntInt> CreateBasePropList(BasePropertyConfig? config) private static List<ArrayIntInt> CreateBasePropList(BasePropertyConfig? config)
{ {
List<ArrayIntInt> baseProp = []; List<ArrayIntInt> baseProp = [];