Compare commits

...

3 commits

Author SHA1 Message Date
thexeondev
97bbbbeae9
Merge pull request #4 from ryozm/feat-/resonantChainUnlock
Support unlocking Resonance Chains.
2024-02-23 13:24:16 +03:00
thexeondev
3cf22f41d9
Update RoleController.cs 2024-02-23 13:24:02 +03:00
Ryo
32349137d3 Unlock resonant chain 2024-02-23 14:43:11 +08:00

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 = [];