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

BUGFIX: ns.corporation.bribe can bribe faction that player is not member of #1966

Conversation

catloversg
Copy link
Contributor

I found this bug when checking the UI of the bribing feature. We disable the "Bribe" button when the player is not a member of any valid factions, but with ns.corporation.bribe, they can bribe a valid faction even when they are not a member of that faction. This PR fixes it.

Test save:
test bribe.gz

Test code:

/** @param {NS} ns */
export async function main(ns) {
  ns.tail();
  ns.clearLog();
  ns.print(Factions.CyberSec.playerReputation);
  ns.corporation.bribe("CyberSec", 1e12);
  ns.print(Factions.CyberSec.playerReputation);
  for (const server of GetAllServers()) {
    if (server.hostname === "CSEC") {
      server.backdoorInstalled = true;
      break;
    }
  }
  ns.singularity.checkFactionInvitations();
  ns.singularity.joinFaction("CyberSec");
  ns.corporation.bribe("CyberSec", 1e12);
  ns.print(Factions.CyberSec.playerReputation);
}

Before:

0
1000
singularity.joinFaction: Joined the 'CyberSec' faction.
2000

After:

0
corporation.bribe: You are not a member of CyberSec.
0
singularity.joinFaction: Joined the 'CyberSec' faction.
1000

@d0sboots d0sboots merged commit adc39ad into bitburner-official:dev Feb 16, 2025
5 checks passed
@catloversg catloversg deleted the pull-request/bugfix/ns.corporation.bribe-can-bribe-faction-that-player-is-not-member-of branch February 16, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants