Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: Feature Request: Provide "ns.${Api}.isEligible" functions for each restricted APIs. #1632

Open
bupjae opened this issue Aug 26, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@bupjae
Copy link
Contributor

bupjae commented Aug 26, 2024

Based on:

Assume the user doesn't have SF4 / SF5 and currently not in BN4 / BN5 in this discussion.

For example, if the user wants to know whether they can use Stanek's API, the only way is run ns.stanek.acceptGift() and see return value.
However, running that causes the user accept gift, and suffers 10% all stat penalty, therefore it is not suitable for check eligibility of Stanek's API.

Almost all features in this game has similar issues; the user should actually start/join/create the feature to know whether the user is eligibile to access.

This feature request is to provide NS function isEligible for each API.

Sample ns.stanek.isEligible function:

isEligible: () => () => {
    // You already accepted Stanek's gift. You can use stanek API of course.
    if (Player.hasAugmentation(AugmentationName.StaneksGift1, true)) return true;
    // You don't have SF13 and you'are not in BN13. You don't know anything about The Church.
    if (!Player.canAccessCotMG()) return false;
    // If you installed other augmentation before accepting gift, The Church will treat you filth and you can't use stanek API.
    // Otherwise, you can use stanek API, starting from acceptGift().
    return [...Player.augmentations, ...Player.queuedAugmentations].filter(
          (a) => a.name !== AugmentationName.NeuroFluxGovernor,
        ).length === 0;
}
@gmcew gmcew added the enhancement New feature or request label Aug 26, 2024
@d0sboots
Copy link
Collaborator

For many of the APIs, you can check simply by trying to call them. You'll get an exception on failure, that indicates you don't have access.

However, I'm not against adding an explicit boolean check.

What you're asking for here (and what happened with corp) is slightly different: That's about checking if you can gain access to the relevant feature, as opposed to if you already have access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants
@d0sboots @bupjae @gmcew and others