Skip to content

Commit

Permalink
allow skipping more modules
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Oct 30, 2023
1 parent 85539e3 commit 87360d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/modules/faucet-balance/FaucetBalanceModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export class FaucetBalanceModule extends BaseModule<IFaucetBalanceConfig> {
}

private async processSessionRewardFactor(session: FaucetSession, rewardFactors: ISessionRewardFactor[]): Promise<void> {
if(session.getSessionData<Array<string>>("skip.modules", []).indexOf(this.moduleName) !== -1)
return;
await this.refreshBalanceRestriction();
if(this.balanceRestriction !== 100) {
rewardFactors.push({
Expand Down
8 changes: 6 additions & 2 deletions src/modules/faucet-outflow/FaucetOutflowModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class FaucetOutflowModule extends BaseModule<IFaucetOutflowConfig> {
);
this.moduleManager.addActionHook(
this, ModuleHookAction.SessionRewarded, 5, "faucet outflow",
(session: FaucetSession, amount: bigint) => this.updateState(amount)
(session: FaucetSession, amount: bigint) => this.updateState(session, amount)
);
this.enforceBalanceBoundaries();
}
Expand All @@ -44,6 +44,8 @@ export class FaucetOutflowModule extends BaseModule<IFaucetOutflowConfig> {
}

private async processSessionRewardFactor(session: FaucetSession, rewardFactors: ISessionRewardFactor[]): Promise<void> {
if(session.getSessionData<Array<string>>("skip.modules", []).indexOf(this.moduleName) !== -1)
return;
let outflowRestriction = this.getOutflowRestriction();
if(outflowRestriction < 100) {
rewardFactors.push({
Expand Down Expand Up @@ -83,7 +85,9 @@ export class FaucetOutflowModule extends BaseModule<IFaucetOutflowConfig> {
}
}

public updateState(minedAmount: bigint) {
public updateState(session: FaucetSession, minedAmount: bigint) {
if(session.getSessionData<Array<string>>("skip.modules", []).indexOf(this.moduleName) !== -1)
return;
if(minedAmount < 0)
return;

Expand Down

0 comments on commit 87360d7

Please sign in to comment.